[!] origin policy w websocket

This commit is contained in:
monastyr 2018-11-15 01:52:44 +01:00
parent e00947806f
commit e7d21df9b3
15 changed files with 675 additions and 54 deletions

58
backend/go_mysql/main.go Normal file
View File

@ -0,0 +1,58 @@
package main
import (
"database/sql"
"fmt"
_ "github.com/go-sql-driver/mysql"
)
type User struct {
Name string `json:"name"`
}
type User2 struct {
Name string `json:"name8"`
Name2 string `json:"name8"`
}
func main() {
fmt.Println("Go Mysql Tutorial")
db, err := sql.Open("mysql", "root:password@tcp(127.0.0.1:3306)/testdb")
if err != nil {
panic(err.Error())
}
fmt.Println("Succesfully Connected to MySQL database")
defer db.Close() //keep the connection open for the remainder of this function
// insert, err := db.Query("INSERT INTO users VALUES('ELLIOT3')")
insert, err := db.Query("INSERT INTO users2 VALUES('a1', 'b1')")
if err != nil {
panic(err.Error)
}
defer insert.Close()
fmt.Println("Succes Insert")
results, err := db.Query("SELECT * FROM users2")
if err != nil {
panic(err.Error())
}
for results.Next() {
var user2 User2
err = results.Scan(&user2.Name, &user2.Name2)
if err != nil {
panic(err.Error())
}
fmt.Println(user2.Name, user2.Name2)
}
fmt.Println(*results)
}

33
backend/go_orm/main.go Normal file
View File

@ -0,0 +1,33 @@
package main
import (
"fmt"
"log"
"net/http"
"github.com/gorilla/mux"
)
func helloWorld(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello World")
}
func hangleRequests() {
myRouter := mux.NewRouter().StrictSlash(true)
myRouter.HandleFunc("/", helloWorld).Methods("GET")
myRouter.HandleFunc("/users", AllUsers).Methods("GET")
myRouter.HandleFunc("/user/{name}/{email}", NewUser).Methods("POST")
myRouter.HandleFunc("/user/{name}", DeleteUser).Methods("DELETE")
myRouter.HandleFunc("/user/{name}/{email}", UpdateUser).Methods("PUT")
log.Fatal(http.ListenAndServe(":8081", myRouter))
}
func main() {
fmt.Println("GO ORM Tutorial")
InitialMigration()
hangleRequests()
}

BIN
backend/go_orm/test.db Normal file

Binary file not shown.

109
backend/go_orm/user.go Normal file
View File

@ -0,0 +1,109 @@
// Użycie ORM dla bazy sqlite3
// w innych bazach na podobnej zasadzie
// operowanie raczej na metodach db niż modeli
package main
import (
"encoding/json"
"fmt"
"net/http"
"github.com/gorilla/mux"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/sqlite"
)
var db *gorm.DB
var err error
type User struct { // ~= models.py
gorm.Model //modeled somehow in the database
Name string
Email string
}
func InitialMigration() {
db, err = gorm.Open("sqlite3", "test.db")
if err != nil {
fmt.Println(err.Error())
panic("Failed to connect to database")
}
defer db.Close()
db.AutoMigrate(&User{}) //migracja modelu
}
func AllUsers(w http.ResponseWriter, r *http.Request) {
//widok
db, err = gorm.Open("sqlite3", "test.db")
if err != nil {
panic("Could not connect to the database")
}
defer db.Close()
var users []User //lista obiektow
db.Find(&users)
json.NewEncoder(w).Encode(users) //parsowanie lisy na jsona
}
func NewUser(w http.ResponseWriter, r *http.Request) {
//widok
db, err = gorm.Open("sqlite3", "test.db")
if err != nil {
panic("Could not connect to database")
}
defer db.Close()
// pobieranie danych z url'a
vars := mux.Vars(r) //wyłuskanie danych z obiekt request
name := vars["name"]
email := vars["email"]
// tworzenie obiektu Name - atrybut struktury, name wartosc zmiennej z url'a
db.Create(&User{Name: name, Email: email})
fmt.Fprintf(w, "New user successfully created")
}
func DeleteUser(w http.ResponseWriter, r *http.Request) {
//widok
db, err = gorm.Open("sqlite3", "test.db")
if err != nil {
panic("Could not connect to the database")
}
defer db.Close()
vars := mux.Vars(r) //wyłuskanie danych z obiekt request
name := vars["name"] //wyłuskanie danych ze zmiennej z url'a
//[!] USUWA WSZYSTKO db.Delete(&User{Name: name}) //USUWA WSZYSTKO [!]
var user User
//znajdz obiekt user, gdzie atrybut name jest równy zmiennej name
db.Where("name = ?", name).Find(&user)
//znajduje tylko jeden obiekt jesli dane sa identyczne w baze i tylko jeden usuwa
db.Delete(&user)
fmt.Fprintf(w, "DELETE User")
}
func UpdateUser(w http.ResponseWriter, r *http.Request) {
//widok
db, err = gorm.Open("sqlite3", "test.db")
if err != nil {
panic("Could not connect to the database")
}
defer db.Close()
vars := mux.Vars(r)
name := vars["name"]
email := vars["email"]
var user User
db.Where("name =?", name).Find(&user)
user.Email = email
db.Save(&user)
fmt.Fprintf(w, "UPDATE User")
}

View File

@ -0,0 +1,48 @@
//websocket zamiast rest api
// problem tylko z wysiwietlaniem danych z przegladarki
//Firefox:
//Zablokowano żądanie do zasobu innego pochodzenia: zasady „Same Origin Policy”
//nie pozwalają wczytywać zdalnych zasobów z „http://localhost:5000/socket.io/?EIO=3&transport=polling&t=MSKrtCr”
// (brakujący nagłówek CORS „Access-Control-Allow-Origin”).[Więcej informacji]
//Chrome: to samo co ^
//
//
//
package main
import (
"fmt"
"log"
"net/http"
socketio "github.com/googollee/go-socket.io" //alias do biblioteki importu
)
func main() {
fmt.Println("Hello World")
server, err := socketio.NewServer(nil)
if err != nil {
log.Fatal(err)
}
server.On("connection", func(so socketio.Socket) {
log.Println("New Connection")
//handle chat message to and front
so.Join("chat")
so.On("chat message", func(msg string) {
log.Println("Message Received From Client: " + msg)
so.BroadcastTo("chat", "chat message", msg)
})
})
//file system handler
fs := http.FileServer(http.Dir("static")) //do folderu
http.Handle("/", fs)
http.Handle("/socket.io/", server) //native html socket
log.Fatal(http.ListenAndServe(":5000", nil))
}

View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Go WebSocket Tutorial</title>
</head>
<body>
<h2>Hello World</h2>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.1.1/socket.io.js"></script>
<!-- socket io library ^ -->
<script>
const socket = io('http://localhost:5000/socket.io/');
socket.emit("chat message", "Heloooooooooo")
socket.on("chat message", (msg) => {
console.log(msg);
})
</script>
</body>
</html>

44
backend/testt_go/tut3.go Normal file
View File

@ -0,0 +1,44 @@
//testowanie w GO
//tutaj kod do przetestowania
//uwaga jak w wielu plikach jest package main, to test sie wywali na twarz
//pliki umieszcza wosobnych folderach jak tutaj
// λ go test
// # _/C_/Users/dp/Desktop/PracowaniaProgramowania/backend [_/C_/Users/dp/Desktop/PracowaniaProgramowania/backend.test]
// .\duplication.go:10:6: main redeclared in this block
// previous declaration at .\cw1.go:12:6
// .\echo1.go:8:6: main redeclared in this block
// previous declaration at .\duplication.go:10:6
// .\echo2.go:9:6: main redeclared in this block
// previous declaration at .\echo1.go:8:6
// .\hello.go:5:6: main redeclared in this block
// previous declaration at .\echo2.go:9:6
// .\serverTest.go:12:6: main redeclared in this block
// previous declaration at .\hello.go:5:6
// .\serverTest2.go:15:6: main redeclared in this block
// previous declaration at .\serverTest.go:12:6
// .\tut1.go:37:6: main redeclared in this block
// previous declaration at .\serverTest2.go:15:6
// .\tut2.go:13:6: Article redeclared in this block
// previous declaration at .\tut1.go:11:6
// .\tut2.go:19:6: Articles redeclared in this block
// previous declaration at .\tut1.go:17:6
// .\tut2.go:21:6: allArticles redeclared in this block
// previous declaration at .\tut1.go:19:44
// .\tut2.go:21:6: too many errors
// FAIL _/C_/Users/dp/Desktop/PracowaniaProgramowania/backend [build failed]
package main
import (
"fmt"
)
func Calculate(x int) (result int) {
result = x + 2
return result
}
func main() {
fmt.Println("Go testing tutorial")
result := Calculate(2)
fmt.Println(result)
}

View File

@ -0,0 +1,69 @@
//testowanie w GO
//tutaj testy
//uwaga jak w wielu plikach jest package main, to test sie wywali na twarz
//pliki umieszcza wosobnych folderach jak tutaj
// λ go test
// # _/C_/Users/dp/Desktop/PracowaniaProgramowania/backend [_/C_/Users/dp/Desktop/PracowaniaProgramowania/backend.test]
// .\duplication.go:10:6: main redeclared in this block
// previous declaration at .\cw1.go:12:6
// .\echo1.go:8:6: main redeclared in this block
// previous declaration at .\duplication.go:10:6
// .\echo2.go:9:6: main redeclared in this block
// previous declaration at .\echo1.go:8:6
// .\hello.go:5:6: main redeclared in this block
// previous declaration at .\echo2.go:9:6
// .\serverTest.go:12:6: main redeclared in this block
// previous declaration at .\hello.go:5:6
// .\serverTest2.go:15:6: main redeclared in this block
// previous declaration at .\serverTest.go:12:6
// .\tut1.go:37:6: main redeclared in this block
// previous declaration at .\serverTest2.go:15:6
// .\tut2.go:13:6: Article redeclared in this block
// previous declaration at .\tut1.go:11:6
// .\tut2.go:19:6: Articles redeclared in this block
// previous declaration at .\tut1.go:17:6
// .\tut2.go:21:6: allArticles redeclared in this block
// previous declaration at .\tut1.go:19:44
// .\tut2.go:21:6: too many errors
// FAIL _/C_/Users/dp/Desktop/PracowaniaProgramowania/backend [build failed]
package main
import "testing"
func TestCalculate(t *testing.T) {
if Calculate(2) != 4 {
t.Error("Expected 2+2 to equal 4")
}
// if Calculate(2) != 4 {
// t.Error("Expected 2+2 to equal 4")
// }
}
// func TestCalculate2(t *testing.T) {
// if Calculate(2) != 8 {
// t.Error("Expected 2+2 to equal 8")
// }
// }
func TestTableCalculate(t *testing.T) {
var tests = []struct {
input int
excpected int
}{
{2, 4},
{-1, 1},
{0, 2},
{9999, 10001},
}
//petelka foreach
for _, test := range tests {
if output := Calculate(test.input); output != test.excpected { //przypisanie a potem porownanie: 2 instrukcje w jednj linii - dlatego ;
t.Error("Tested Failed: {} inputted, {} expected , received {}", test.input, test.excpected, output) //jak .format() w py
}
}
}
//brak funkcji main o.Ó
//funkcje wykonuja sie po kolei jak w pythonie

49
backend/tut2.go Normal file
View File

@ -0,0 +1,49 @@
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"github.com/gorilla/mux"
)
//struktura artykuly
type Article struct {
Title string `json:"Title"`
Desc string `json:"desc"`
Content string `json:"content"`
}
type Articles []Article
func allArticles(w http.ResponseWriter, r *http.Request) {
articles := Articles{
Article{Title: "Test Title", Desc: "Test Description", Content: "Hello World"}, //json i szesceinne nawiasy!, przecinek na koniec
}
fmt.Println("Endpoint Hit: All Articles Endpoint")
json.NewEncoder(w).Encode(articles)
}
func homePage(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Homepage Enpoint Hit")
}
func testPostArticles(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Test POST endpoint worker")
}
func handleRequests() {
myRouter := mux.NewRouter().StrictSlash(true)
myRouter.HandleFunc("/", homePage)
myRouter.HandleFunc("/articles", allArticles).Methods("GET") //obsługa tylko GET
myRouter.HandleFunc("/articles", testPostArticles).Methods("POST") // -,- POST; wymagana nowa nazwa funkcji; ale ten sam url co wyzej ^
log.Fatal(http.ListenAndServe(":8081", myRouter))
}
func main() {
handleRequests()
}

39
backend/tut2a.go Normal file
View File

@ -0,0 +1,39 @@
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
)
//struktura artykuly
type Article struct {
Title string `json:"Title"`
Desc string `json:"desc"`
Content string `json:"content"`
}
type Articles []Article
func allArticles(w http.ResponseWriter, r *http.Request) {
articles := Articles{
Article{Title: "Test Title", Desc: "Test Description", Content: "Hello World"}, //json i szesceinne nawiasy!, przecinek na koniec
}
fmt.Println("Endpoint Hit: All Articles Endpoint")
json.NewEncoder(w).Encode(articles)
}
func homePage(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Homepage Enpoint Hit")
}
func handleRequests() {
http.HandleFunc("/", homePage)
http.HandleFunc("/articles", allArticles)
log.Fatal(http.ListenAndServe(":8081", nil))
}
func main() {
handleRequests()
}

View File

@ -344,8 +344,7 @@
"ansi-regex": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
"dev": true
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
},
"ansi-styles": {
"version": "3.2.1",
@ -1644,6 +1643,23 @@
"esutils": "^2.0.2"
}
},
"babel-polyfill": {
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.23.0.tgz",
"integrity": "sha1-g2TKYt+Or7gwSZ9pkXdGbDsDSZ0=",
"requires": {
"babel-runtime": "^6.22.0",
"core-js": "^2.4.0",
"regenerator-runtime": "^0.10.0"
},
"dependencies": {
"regenerator-runtime": {
"version": "0.10.5",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz",
"integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg="
}
}
},
"babel-preset-env": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.7.0.tgz",
@ -1776,7 +1792,6 @@
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
"dev": true,
"requires": {
"core-js": "^2.4.0",
"regenerator-runtime": "^0.11.0"
@ -2016,6 +2031,24 @@
"integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=",
"dev": true
},
"bootstrap": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.1.3.tgz",
"integrity": "sha512-rDFIzgXcof0jDyjNosjv4Sno77X4KuPeFxG2XZZv1/Kc8DRVGVADdoQyyOVDwPqL36DDmtCQbrpMCqvpPLJQ0w=="
},
"bootstrap-vue": {
"version": "2.0.0-rc.11",
"resolved": "https://registry.npmjs.org/bootstrap-vue/-/bootstrap-vue-2.0.0-rc.11.tgz",
"integrity": "sha512-LxR+oL8yKr1DVoWUWTX+XhiT0xaTMH6142u2VSFDm4tewTH8HIrzN2YIl7HLZrw2DIuE9bRMIdWJqqn3aQe7Hw==",
"requires": {
"bootstrap": "^4.1.1",
"lodash.get": "^4.4.2",
"lodash.startcase": "^4.4.0",
"opencollective": "^1.0.3",
"popper.js": "^1.12.9",
"vue-functional-data-merge": "^2.0.5"
}
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
@ -2389,8 +2422,7 @@
"chardet": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz",
"integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=",
"dev": true
"integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I="
},
"check-types": {
"version": "7.4.0",
@ -2631,7 +2663,6 @@
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz",
"integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=",
"dev": true,
"requires": {
"restore-cursor": "^2.0.0"
}
@ -2645,8 +2676,7 @@
"cli-width": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz",
"integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=",
"dev": true
"integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk="
},
"cliui": {
"version": "4.1.0",
@ -3017,8 +3047,7 @@
"core-js": {
"version": "2.5.7",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz",
"integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==",
"dev": true
"integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw=="
},
"core-util-is": {
"version": "1.0.2",
@ -3968,6 +3997,14 @@
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=",
"dev": true
},
"encoding": {
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz",
"integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=",
"requires": {
"iconv-lite": "~0.4.13"
}
},
"end-of-stream": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz",
@ -4126,8 +4163,7 @@
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
"dev": true
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
},
"escodegen": {
"version": "1.11.0",
@ -4744,7 +4780,6 @@
"version": "2.2.0",
"resolved": "http://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz",
"integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==",
"dev": true,
"requires": {
"chardet": "^0.4.0",
"iconv-lite": "^0.4.17",
@ -4845,7 +4880,6 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz",
"integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=",
"dev": true,
"requires": {
"escape-string-regexp": "^1.0.5"
}
@ -5944,7 +5978,6 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
"dev": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -6316,7 +6349,6 @@
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"dev": true,
"requires": {
"safer-buffer": ">= 2.1.2 < 3"
}
@ -6665,8 +6697,7 @@
"is-fullwidth-code-point": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
"dev": true
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8="
},
"is-generator-fn": {
"version": "1.0.0",
@ -6754,8 +6785,7 @@
"is-promise": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz",
"integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=",
"dev": true
"integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o="
},
"is-regex": {
"version": "1.0.4",
@ -6775,8 +6805,7 @@
"is-stream": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=",
"dev": true
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ="
},
"is-svg": {
"version": "2.1.0",
@ -7720,8 +7749,7 @@
"lodash": {
"version": "4.17.11",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz",
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==",
"dev": true
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg=="
},
"lodash._arraycopy": {
"version": "3.0.0",
@ -7857,6 +7885,11 @@
}
}
},
"lodash.get": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
"integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk="
},
"lodash.isarguments": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz",
@ -7916,6 +7949,11 @@
"integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=",
"dev": true
},
"lodash.startcase": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/lodash.startcase/-/lodash.startcase-4.4.0.tgz",
"integrity": "sha1-lDbjTtJgk+1/+uGTYUQ1CRXZrdg="
},
"lodash.uniq": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz",
@ -8181,8 +8219,7 @@
"mimic-fn": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz",
"integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==",
"dev": true
"integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ=="
},
"minimalistic-assert": {
"version": "1.0.1",
@ -8384,8 +8421,7 @@
"mute-stream": {
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz",
"integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=",
"dev": true
"integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s="
},
"nan": {
"version": "2.11.1",
@ -8525,6 +8561,15 @@
}
}
},
"node-fetch": {
"version": "1.6.3",
"resolved": "http://registry.npmjs.org/node-fetch/-/node-fetch-1.6.3.tgz",
"integrity": "sha1-3CNO3WSJmC1Y6PDbT2lQKavNjAQ=",
"requires": {
"encoding": "^0.1.11",
"is-stream": "^1.0.1"
}
},
"node-forge": {
"version": "0.7.5",
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.5.tgz",
@ -8674,8 +8719,7 @@
"object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",
"dev": true
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
},
"object-copy": {
"version": "0.1.0",
@ -8799,11 +8843,86 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz",
"integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=",
"dev": true,
"requires": {
"mimic-fn": "^1.0.0"
}
},
"opencollective": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/opencollective/-/opencollective-1.0.3.tgz",
"integrity": "sha1-ruY3K8KBRFg2kMPKja7PwSDdDvE=",
"requires": {
"babel-polyfill": "6.23.0",
"chalk": "1.1.3",
"inquirer": "3.0.6",
"minimist": "1.2.0",
"node-fetch": "1.6.3",
"opn": "4.0.2"
},
"dependencies": {
"ansi-escapes": {
"version": "1.4.0",
"resolved": "http://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz",
"integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4="
},
"ansi-styles": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4="
},
"chalk": {
"version": "1.1.3",
"resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"requires": {
"ansi-styles": "^2.2.1",
"escape-string-regexp": "^1.0.2",
"has-ansi": "^2.0.0",
"strip-ansi": "^3.0.0",
"supports-color": "^2.0.0"
}
},
"inquirer": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.0.6.tgz",
"integrity": "sha1-4EqqnQW3o8ubD0B9BDdfBEcZA0c=",
"requires": {
"ansi-escapes": "^1.1.0",
"chalk": "^1.0.0",
"cli-cursor": "^2.1.0",
"cli-width": "^2.0.0",
"external-editor": "^2.0.1",
"figures": "^2.0.0",
"lodash": "^4.3.0",
"mute-stream": "0.0.7",
"run-async": "^2.2.0",
"rx": "^4.1.0",
"string-width": "^2.0.0",
"strip-ansi": "^3.0.0",
"through": "^2.3.6"
}
},
"minimist": {
"version": "1.2.0",
"resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
},
"opn": {
"version": "4.0.2",
"resolved": "http://registry.npmjs.org/opn/-/opn-4.0.2.tgz",
"integrity": "sha1-erwi5kTf9jsKltWrfyeQwPAavJU=",
"requires": {
"object-assign": "^4.0.1",
"pinkie-promise": "^2.0.0"
}
},
"supports-color": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc="
}
}
},
"opener": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/opener/-/opener-1.5.1.tgz",
@ -8908,8 +9027,7 @@
"os-tmpdir": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
"dev": true
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ="
},
"osenv": {
"version": "0.1.5",
@ -9166,14 +9284,12 @@
"pinkie": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
"integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=",
"dev": true
"integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA="
},
"pinkie-promise": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
"integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=",
"dev": true,
"requires": {
"pinkie": "^2.0.0"
}
@ -9199,6 +9315,11 @@
"integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==",
"dev": true
},
"popper.js": {
"version": "1.14.5",
"resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.14.5.tgz",
"integrity": "sha512-fs4Sd8bZLgEzrk8aS7Em1qh+wcawtE87kRUJQhK6+LndyV1HerX7+LURzAylVaTyWIn5NTB/lyjnWqw/AZ6Yrw=="
},
"portfinder": {
"version": "1.0.19",
"resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.19.tgz",
@ -12026,8 +12147,7 @@
"regenerator-runtime": {
"version": "0.11.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==",
"dev": true
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg=="
},
"regenerator-transform": {
"version": "0.10.1",
@ -12269,7 +12389,6 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz",
"integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=",
"dev": true,
"requires": {
"onetime": "^2.0.0",
"signal-exit": "^3.0.2"
@ -12319,7 +12438,6 @@
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz",
"integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=",
"dev": true,
"requires": {
"is-promise": "^2.1.0"
}
@ -12333,6 +12451,11 @@
"aproba": "^1.1.1"
}
},
"rx": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/rx/-/rx-4.1.0.tgz",
"integrity": "sha1-pfE/957zt0D+MKqAP7CfmIBdR4I="
},
"rx-lite": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz",
@ -12366,8 +12489,7 @@
"safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"dev": true
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"sane": {
"version": "2.5.2",
@ -12870,8 +12992,7 @@
"signal-exit": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
"dev": true
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0="
},
"slash": {
"version": "1.0.0",
@ -13352,7 +13473,6 @@
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
"integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",
"dev": true,
"requires": {
"is-fullwidth-code-point": "^2.0.0",
"strip-ansi": "^4.0.0"
@ -13361,14 +13481,12 @@
"ansi-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
"dev": true
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg="
},
"strip-ansi": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
"integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
"dev": true,
"requires": {
"ansi-regex": "^3.0.0"
}
@ -13388,7 +13506,6 @@
"version": "3.0.1",
"resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -13534,8 +13651,7 @@
"through": {
"version": "2.3.8",
"resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz",
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=",
"dev": true
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
},
"through2": {
"version": "2.0.5",
@ -13578,7 +13694,6 @@
"version": "0.0.33",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
"integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
"dev": true,
"requires": {
"os-tmpdir": "~1.0.2"
}
@ -14182,6 +14297,11 @@
}
}
},
"vue-functional-data-merge": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/vue-functional-data-merge/-/vue-functional-data-merge-2.0.7.tgz",
"integrity": "sha512-pvLc+H+x2prwBj/uSEIITyxjz/7ZUVVK8uYbrYMmhDvMXnzh9OvQvVEwcOSBQjsubd4Eq41/CSJaWzy4hemMNQ=="
},
"vue-hot-reload-api": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.1.tgz",

View File

@ -14,6 +14,7 @@
"build": "node build/build.js"
},
"dependencies": {
"bootstrap-vue": "^2.0.0-rc.11",
"vue": "^2.5.2",
"vue-router": "^3.0.1",
"vuex": "^3.0.1"

View File

@ -0,0 +1,17 @@
<template>
<!--https://bootstrap-vue.js.org/docs/ -->
<!-- npm i bootstrap-vue -->
<div id="b-menu">
<b-btn v-b-toggle.collapse1 variant="primary">Toggle Collapse</b-btn>
<b-collapse id="collapse1" class="mt-2">
<b-card>
<p class="card-text">Collapse contents Here</p>
<b-btn v-b-toggle.collapse1_inner size="sm">Toggle Inner Collapse</b-btn>
<b-collapse id=collapse1_inner class="mt-2">
<b-card>Hello!</b-card>
</b-collapse>
</b-card>
</b-collapse>
</div>
</template>

View File

@ -1,7 +1,8 @@
<template>
<div class="hello2">
<!-- <transition-element></transition-element> -->
<sidenav-menu></sidenav-menu>
<!-- <sidenav-menu></sidenav-menu> -->
<b-menu></b-menu>
</div>
</template>

View File

@ -6,10 +6,18 @@ import router from './router'
import { store } from './store/store' //importowanie central store;
import SidenavMenu from '@/components/SidenavMenu'
import TransitionElement from '@/components/TransitionElement'
import BootstrapVue from 'bootstrap-vue'
import BMenu from '@/components/BootstrapMenu'
Vue.component('sidenav-menu', SidenavMenu) // globalnby import menu
Vue.component('transition-element', TransitionElement) // globalnby import menu
Vue.component('b-menu', BMenu) // globalnby import menu
Vue.use(BootstrapVue);
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'
Vue.config.productionTip = false