diff --git a/build.sh b/build.sh index e892e7b..4281cb8 100755 --- a/build.sh +++ b/build.sh @@ -3,13 +3,16 @@ echo "Creating build environment" docker buildx create --name pibuilder --use -echo "Printing build environment info" -docker buildx inspect --bootstrap - -echo "Doing build" +echo "Building backend" docker buildx build \ --platform linux/arm64 \ --push \ -t gitea.coupxd.com/cody/go-weather:latest \ . +echo "Building frontend" +docker buildx build \ + --platform linux/arm64 \ + --push \ + -t gitea.coupxd.com/cody/go-weather-frontend:latest \ + ./frontend diff --git a/frontend/nginx.conf b/frontend/nginx.conf index daf478c..8323f3c 100644 --- a/frontend/nginx.conf +++ b/frontend/nginx.conf @@ -6,7 +6,7 @@ server { try_files $uri $uri/ /index.html; } location /api/ { - proxy_pass http://go-weather:8080/; + proxy_pass http://go-weather:8080; } } diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 4c0d71d..572570e 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -16,7 +16,6 @@ export default defineConfig({ proxy: { "/api": { target: "http://localhost:8080", - rewrite: (path) => path.replace(/^\/api/, ""), }, }, }, diff --git a/main.go b/main.go index 3237603..f775454 100644 --- a/main.go +++ b/main.go @@ -75,11 +75,11 @@ func main() { go startPoller(database, weatherService, config.DefaultCity, 10*time.Minute) // Register routes - http.HandleFunc("/weather/fetch", weatherHandler.FetchWeather) - http.HandleFunc("/weather/history", weatherHandler.GetHistory) - http.HandleFunc("/health", handlers.Health) - http.HandleFunc("/latest-temperature", handlers.LatestTemperature) - http.HandleFunc("/test", handlers.Test) + http.HandleFunc("/api/weather/fetch", weatherHandler.FetchWeather) + http.HandleFunc("/api/weather/history", weatherHandler.GetHistory) + http.HandleFunc("/api/health", handlers.Health) + http.HandleFunc("/api/latest-temperature", handlers.LatestTemperature) + http.HandleFunc("/api/test", handlers.Test) // Start server go func() { fmt.Println("server listening on :8080")