put code that worked where the code that didn't used to be

This commit is contained in:
2023-08-07 23:01:38 -04:00
parent dbbeaa05f3
commit 9c7d3ad787
2 changed files with 5 additions and 3 deletions

3
.gitignore vendored
View File

@@ -1,4 +1,5 @@
.DS_Store
.idea/
gun_inventory.sqlite
*.sqlite
gun-manager
dist/

View File

@@ -22,7 +22,6 @@ func main() {
}
_, err := sql.NewDb(dbFile)
if err != nil {
log.Fatal(err)
}
@@ -31,10 +30,12 @@ func main() {
e.Use(middleware.Logger())
e.Use(middleware.Recover())
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,
}))
e.Static("/", "dist")
e.GET("/gun", Guns.Get)
e.PUT("/gun/:id", Guns.UpdateGun)
e.GET("/gun/:id", Guns.GetById)