mirror of
https://github.com/dstotijn/hetty.git
synced 2025-07-01 18:47:29 -04:00
Enforce trailing slashes on API paths
This ensures that the Next.js app works consistently both when running in dev mode as well as when it has been exported to static HTML/JS.
This commit is contained in:
@ -81,11 +81,11 @@ func main() {
|
||||
hostname, _ := os.Hostname()
|
||||
host, _, _ := net.SplitHostPort(req.Host)
|
||||
return strings.EqualFold(host, hostname) || (req.Host == "hetty.proxy" || req.Host == "localhost:8080")
|
||||
}).Subrouter()
|
||||
}).Subrouter().StrictSlash(true)
|
||||
|
||||
// GraphQL server.
|
||||
adminRouter.Path("/api/playground").Handler(playground.Handler("GraphQL Playground", "/api/graphql"))
|
||||
adminRouter.Path("/api/graphql").Handler(handler.NewDefaultServer(api.NewExecutableSchema(api.Config{Resolvers: &api.Resolver{
|
||||
adminRouter.Path("/api/playground/").Handler(playground.Handler("GraphQL Playground", "/api/graphql/"))
|
||||
adminRouter.Path("/api/graphql/").Handler(handler.NewDefaultServer(api.NewExecutableSchema(api.Config{Resolvers: &api.Resolver{
|
||||
RequestLogService: reqLogService,
|
||||
}})))
|
||||
|
||||
|
Reference in New Issue
Block a user