struktura katalogow
This commit is contained in:
parent
ae37039556
commit
616778cac8
0
backend/golang-gin/cards_logger.py
Normal file
0
backend/golang-gin/cards_logger.py
Normal file
0
backend/golang-gin/config.go
Normal file
0
backend/golang-gin/config.go
Normal file
77
backend/golang-gin/connector_couchdb.go
Normal file
77
backend/golang-gin/connector_couchdb.go
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
|
"github.com/zemirco/couchdb"
|
||||||
|
)
|
||||||
|
|
||||||
|
// create your own document
|
||||||
|
type dummyDocument struct {
|
||||||
|
couchdb.Document
|
||||||
|
Foo string `json:"foo"`
|
||||||
|
Beep string `json:"beep"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func connectCouchdb(url_couchdb string) {
|
||||||
|
if url_couchdb == "" {
|
||||||
|
url_couchdb = "http://127.0.0.1:5984/"
|
||||||
|
}
|
||||||
|
|
||||||
|
u, err := url.Parse(url_couchdb)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return u, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// start
|
||||||
|
func main() {
|
||||||
|
|
||||||
|
u, err = connectCouchdb("")
|
||||||
|
// create a new client
|
||||||
|
client, err := couchdb.NewClient(u)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// get some information about your CouchDB
|
||||||
|
info, err := client.Info()
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
fmt.Println(info)
|
||||||
|
|
||||||
|
// // create a database
|
||||||
|
// if _, err = client.Create("dummy"); err != nil {
|
||||||
|
// panic(err)
|
||||||
|
// }
|
||||||
|
|
||||||
|
// use your new "dummy" database and create a document
|
||||||
|
db := client.Use("dummy")
|
||||||
|
doc := &dummyDocument{
|
||||||
|
Foo: "bar",
|
||||||
|
Beep: "bopp",
|
||||||
|
}
|
||||||
|
result, err := db.Post(doc)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// get id and current revision.
|
||||||
|
if err := db.Get(doc, result.ID); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete document
|
||||||
|
if _, err = db.Delete(doc); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// and finally delete the database
|
||||||
|
if _, err = client.Delete("dummy"); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
0
backend/golang-gin/connector_mysql.go
Normal file
0
backend/golang-gin/connector_mysql.go
Normal file
13
backend/golang-gin/decorators.go
Normal file
13
backend/golang-gin/decorators.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GenerateJWT() (string, error) {
|
||||||
|
fmt.Println("Generowanie JWT tokena dla klienta")
|
||||||
|
}
|
||||||
|
|
||||||
|
func ValidateToken() (string, error) {
|
||||||
|
fmt.Println("Walidacja Tokena dla tresci dostepnych tylko dla zalogowanych użytkowników")
|
||||||
|
}
|
@ -55,6 +55,7 @@ func main() {
|
|||||||
// /jokes/like/:jokeID - which will capture likes sent to a particular joke
|
// /jokes/like/:jokeID - which will capture likes sent to a particular joke
|
||||||
api.GET("/jokes", JokeHandler)
|
api.GET("/jokes", JokeHandler)
|
||||||
api.POST("/jokes/like/:jokeID", LikeJoke)
|
api.POST("/jokes/like/:jokeID", LikeJoke)
|
||||||
|
api.POST("/cards", getAllCards)
|
||||||
|
|
||||||
// Start and run the server
|
// Start and run the server
|
||||||
router.Run(":3000")
|
router.Run(":3000")
|
||||||
|
56
backend/golang-gin/models.go
Normal file
56
backend/golang-gin/models.go
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
// Structura karty
|
||||||
|
|
||||||
|
type Card struct {
|
||||||
|
ID int `json:"id" binding:"required"`
|
||||||
|
Type int `json:"typ"` //0 karta pytanie, 1 karta odpowiedź
|
||||||
|
Blank int `json:"puste" binding:"required"` //ile kart odpowiedzi na pytanie
|
||||||
|
Text string `json:"tekst" binding:"required"` // podłoga to luka
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lista card
|
||||||
|
var cards = []Card{
|
||||||
|
Card{0, 0, 0, "Adoptowanie dziecka tylko po, by porzucić je w galerii handlowej."},
|
||||||
|
Card{1, 0, 0, "Sieroty, które wybuchają gdy ktoś je tylko pokocha."},
|
||||||
|
Card{2, 0, 0, "Niekończąca się aktualizacja Windowsa"},
|
||||||
|
Card{3, 0, 0, "Bug."},
|
||||||
|
Card{4, 0, 0, "Wadliwe testy jednostkowe."},
|
||||||
|
Card{5, 0, 0, "Użyszkodnik."},
|
||||||
|
Card{6, 0, 0, "Aplikacja kalkulatora zajmująca 5GB."},
|
||||||
|
Card{7, 1, 1, "Nie programuję w święta, bo _ się rodzi."},
|
||||||
|
Card{8, 1, 1, "3 rzeczy lepsze od seksu. _ _ _"},
|
||||||
|
Card{9, 0, 0, "Audyt bezpiezeństwa teleinformatycznego."},
|
||||||
|
Card{10, 0, 0, "Testy na produkcji."},
|
||||||
|
Card{11, 0, 0, "Pasywno-agresywna notatka o bałaganie w mieszkaniu."},
|
||||||
|
Card{12, 0, 0, "Spanko."},
|
||||||
|
Card{13, 0, 0, "Granko."},
|
||||||
|
Card{14, 0, 0, "Niech żyje zbrodniczy reżim."},
|
||||||
|
Card{15, 0, 0, "Kuce z Orła."},
|
||||||
|
Card{16, 0, 0, "Wałówka od mamy."},
|
||||||
|
Card{17, 0, 0, "10 dni do wypłaty."},
|
||||||
|
Card{18, 0, 0, "Bo to zła kobieta była."},
|
||||||
|
Card{19, 1, 2, "Rude to _ i _."},
|
||||||
|
Card{20, 0, 0, "Tłusty drewnojad."},
|
||||||
|
Card{21, 0, 0, "Zupa z paczki o smaku opakowania."},
|
||||||
|
Card{22, 0, 0, "Przez twe oczy zielone, zielone _."},
|
||||||
|
Card{23, 0, 0, "Naleśnikowa środa."},
|
||||||
|
Card{24, 0, 0, "Kończenie dokumentacji o 5 nad ranem."},
|
||||||
|
Card{25, 0, 0, "Powtarzanie roku."},
|
||||||
|
Card{26, 0, 0, "Warunek."},
|
||||||
|
Card{27, 0, 0, "Pralka."},
|
||||||
|
Card{28, 0, 0, "Chodzenie po starym rynku w szpilkach."},
|
||||||
|
Card{29, 0, 0, "Nieudana migracja bez logów."},
|
||||||
|
Card{30, 0, 0, "Nocny dyżur."},
|
||||||
|
Card{31, 1, 1, "Kac morderca jest wtedy gdy _."},
|
||||||
|
Card{32, 0, 0, "Buka."},
|
||||||
|
Card{33, 0, 0, "Nie mogę wyjść, mam _."},
|
||||||
|
Card{34, 0, 0, "Cukier."},
|
||||||
|
Card{35, 0, 0, "Co?"},
|
||||||
|
Card{36, 0, 0, "Chodź, debata jest."},
|
||||||
|
Card{37, 0, 0, "Ranga w pubg."},
|
||||||
|
Card{38, 0, 0, "Dla Ciebie Pani Sarna."},
|
||||||
|
Card{39, 1, 1, "Palenie papierosów powoduje _."},
|
||||||
|
Card{40, 0, 0, "Syndrom Sztokholmski."},
|
||||||
|
Card{41, 0, 0, "Domyśl się."},
|
||||||
|
}
|
27
backend/golang-gin/views.go
Normal file
27
backend/golang-gin/views.go
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
func getAllCards(c *gin.Context) {
|
||||||
|
fmt.Println("Pobieranie wszystkich kart z bazy - pytań i odpowiedzi")
|
||||||
|
fmt.Println("Długość listy: ", len(cards))
|
||||||
|
|
||||||
|
c.JSON(http.StatusOK, &cards)
|
||||||
|
}
|
||||||
|
|
||||||
|
func addNewCard() {
|
||||||
|
fmt.Println("Dodanie do couchDB nowej karty pytania lub odowiedzi")
|
||||||
|
}
|
||||||
|
|
||||||
|
func addNewUser() {
|
||||||
|
fmt.Println("Rejestracja nowego użytkownika")
|
||||||
|
}
|
||||||
|
|
||||||
|
func loginUser() {
|
||||||
|
fmt.Println("Logowanie użytkownika")
|
||||||
|
}
|
@ -27,7 +27,7 @@ module.exports = {
|
|||||||
|
|
||||||
// Various Dev Server settings
|
// Various Dev Server settings
|
||||||
host: 'localhost', // can be overwritten by process.env.HOST
|
host: 'localhost', // can be overwritten by process.env.HOST
|
||||||
port: 3000, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
|
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
|
||||||
autoOpenBrowser: false,
|
autoOpenBrowser: false,
|
||||||
errorOverlay: true,
|
errorOverlay: true,
|
||||||
notifyOnErrors: true,
|
notifyOnErrors: true,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<router-view/>
|
<!-- <router-view/> -->
|
||||||
|
<button v-on:click="downloadData()">Click backend</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -17,14 +18,12 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
downloadData: function () {
|
downloadData: function () {
|
||||||
console.log('Cokolwiek')
|
console.log('Cokolwiek')
|
||||||
var formData = new FormData()
|
axios.post('/api/jokes/like/0').then(response => {
|
||||||
axios.post('/api/api/jokes/like/0', formData).then(response => {
|
|
||||||
console.log("Server response: ",response.data)
|
console.log("Server response: ",response.data)
|
||||||
})
|
})
|
||||||
|
console.log('Cokolwiek 2')
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
created: function () {
|
|
||||||
this.downloadData()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// https://codepen.io/anon/pen/BGzVpK
|
// https://codepen.io/anon/pen/BGzVpK
|
||||||
|
29
frontend/app/src/components/AddNewCard.vue
Normal file
29
frontend/app/src/components/AddNewCard.vue
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
description: 'Dodawanie do couchDB nowej karty zdefiniowanej przez uzytkownika',
|
||||||
|
note: '',
|
||||||
|
data(){
|
||||||
|
return {
|
||||||
|
newCard : ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
addNewCard(){
|
||||||
|
description: '';
|
||||||
|
note: ''
|
||||||
|
|
||||||
|
},
|
||||||
|
saveToCouchDB(){
|
||||||
|
description: '';
|
||||||
|
note: ''
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
29
frontend/app/src/components/GetAllCardsJson.vue
Normal file
29
frontend/app/src/components/GetAllCardsJson.vue
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
description: 'Pobieranie wszystkich kart i zapisanie ich do pliku json',
|
||||||
|
note: '',
|
||||||
|
data(){
|
||||||
|
return {
|
||||||
|
allCards : ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
getAllCards(){
|
||||||
|
description: '';
|
||||||
|
note: ''
|
||||||
|
|
||||||
|
},
|
||||||
|
saveFileJson(){
|
||||||
|
description: '';
|
||||||
|
note: ''
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
0
frontend/app/src/components/Login.vue
Normal file
0
frontend/app/src/components/Login.vue
Normal file
0
frontend/app/src/components/Register.vue
Normal file
0
frontend/app/src/components/Register.vue
Normal file
Loading…
Reference in New Issue
Block a user