From 9c7d3ad78788a0a06419b5d91bfc08483658b477 Mon Sep 17 00:00:00 2001 From: Ron Rise Date: Mon, 7 Aug 2023 23:01:38 -0400 Subject: [PATCH] put code that worked where the code that didn't used to be --- .gitignore | 3 ++- main.go | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) 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)