You've already forked gun-manager-backend
put code that worked where the code that didn't used to be
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
.idea/
|
.idea/
|
||||||
gun_inventory.sqlite
|
*.sqlite
|
||||||
gun-manager
|
gun-manager
|
||||||
|
dist/
|
||||||
5
main.go
5
main.go
@@ -22,7 +22,6 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_, err := sql.NewDb(dbFile)
|
_, err := sql.NewDb(dbFile)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -31,10 +30,12 @@ func main() {
|
|||||||
e.Use(middleware.Logger())
|
e.Use(middleware.Logger())
|
||||||
e.Use(middleware.Recover())
|
e.Use(middleware.Recover())
|
||||||
e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
|
e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
|
||||||
AllowOrigins: []string{"http://localhost", "http://127.0.0.1:4173"},
|
AllowOrigins: []string{"http://localhost", "http://127.0.0.1:4173", "http://127.0.0.1:8000"},
|
||||||
AllowMethods: nil,
|
AllowMethods: nil,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
e.Static("/", "dist")
|
||||||
|
|
||||||
e.GET("/gun", Guns.Get)
|
e.GET("/gun", Guns.Get)
|
||||||
e.PUT("/gun/:id", Guns.UpdateGun)
|
e.PUT("/gun/:id", Guns.UpdateGun)
|
||||||
e.GET("/gun/:id", Guns.GetById)
|
e.GET("/gun/:id", Guns.GetById)
|
||||||
|
|||||||
Reference in New Issue
Block a user