From c988c762a97fba48add056166665e413ff6c85b7 Mon Sep 17 00:00:00 2001 From: Erno Date: Wed, 22 Oct 2025 08:48:13 +0000 Subject: [PATCH] chore(netlify): add serverless config and function entry for API --- netlify.toml | 15 +++++++++++++++ netlify/functions/api.go | 15 +++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 netlify.toml create mode 100644 netlify/functions/api.go diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 0000000..aedbf3d --- /dev/null +++ b/netlify.toml @@ -0,0 +1,15 @@ +[build] + functions = "netlify/functions" + +[build.environment] + GO_VERSION = "1.22.6" + +# Optional: include static assets used by handlers (placeholders, etc.) +[functions] + included_files = ["assets/**", "public/**", "static/**"] + +# Route all API requests to the serverless function "api" +[[redirects]] + from = "/api/*" + to = "/.netlify/functions/api/:splat" + status = 200 diff --git a/netlify/functions/api.go b/netlify/functions/api.go new file mode 100644 index 0000000..aa5deb2 --- /dev/null +++ b/netlify/functions/api.go @@ -0,0 +1,15 @@ +package main + +import ( + "context" + "net/http" + + bridge "github.com/vercel/go-bridge/go/bridge" + handler "neomovies-api/api" +) + +func main() { + bridge.Start(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + handler.Handler(w, r.WithContext(context.Background())) + })) +}