mirror of
https://github.com/m1k1o/neko.git
synced 2025-08-04 01:09:27 +02:00
add path prefix to server.
This commit is contained in:
parent
c70c8217de
commit
52b4cbcbdf
2 changed files with 22 additions and 7 deletions
|
@ -36,6 +36,12 @@ func New(WebSocketManager types.WebSocketManager, ApiManager types.ApiManager, c
|
|||
MaxAge: 300, // Maximum value not ignored by any of major browsers
|
||||
}))
|
||||
|
||||
if config.PathPrefix != "/" {
|
||||
router.UseBypass(func(h http.Handler) http.Handler {
|
||||
return http.StripPrefix(config.PathPrefix, h)
|
||||
})
|
||||
}
|
||||
|
||||
router.Route("/api", ApiManager.Route)
|
||||
|
||||
router.Get("/api/ws", WebSocketManager.Upgrade(func(r *http.Request) bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue