Skip to content

Commit c032f6e

Browse files
committed
fix: serve backend root endpoint on Vercel
1 parent 3ffff94 commit c032f6e

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

api/index.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,24 @@ func Handler(w http.ResponseWriter, r *http.Request) {
3131
return
3232
}
3333

34+
if r.URL.Path == "/" {
35+
w.Header().Set("Content-Type", "application/json")
36+
w.WriteHeader(http.StatusOK)
37+
_ = json.NewEncoder(w).Encode(map[string]any{
38+
"service": "eventra-auth",
39+
"status": "ok",
40+
"routes": []string{
41+
"GET /health",
42+
"POST /api/v1/auth/register",
43+
"POST /api/v1/auth/login",
44+
"POST /api/v1/auth/refresh",
45+
"POST /api/v1/auth/logout",
46+
"GET /api/v1/auth/me",
47+
},
48+
})
49+
return
50+
}
51+
3452
initOnce.Do(func() {
3553
router, initErr = bootstrap.NewHTTPHandler(context.Background())
3654
})

vercel.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
}
66
},
77
"routes": [
8+
{
9+
"src": "^/$",
10+
"dest": "api/index.go"
11+
},
812
{
913
"src": "/health",
1014
"dest": "api/index.go"

0 commit comments

Comments
 (0)