diff --git a/.gitignore b/.gitignore index 5af8fe0..9816692 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store .idea/ -gun_inventory.sqlite +*.sqlite gun-manager +dist/ \ No newline at end of file diff --git a/main.go b/main.go index a56862c..935338f 100644 --- a/main.go +++ b/main.go @@ -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)