-
Notifications
You must be signed in to change notification settings - Fork 4
/
routes.go
57 lines (44 loc) · 1.57 KB
/
routes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Package routes - Content managed by Project Forge, see [projectforge.md] for details.
package routes
import (
"github.com/fasthttp/router"
"github.com/valyala/fasthttp"
"projectforge.dev/projectforge/app"
"projectforge.dev/projectforge/app/controller"
"projectforge.dev/projectforge/app/controller/clib"
"projectforge.dev/projectforge/app/controller/cutil"
"projectforge.dev/projectforge/app/lib/telemetry/httpmetrics"
"projectforge.dev/projectforge/app/util"
)
//nolint:revive
func AppRoutes(as *app.State, logger util.Logger) fasthttp.RequestHandler {
r := router.New()
r.GET("/", controller.Home)
r.GET("/healthcheck", clib.Healthcheck)
r.GET("/about", clib.About)
r.GET(cutil.DefaultProfilePath, clib.Profile)
r.POST(cutil.DefaultProfilePath, clib.ProfileSave)
r.GET(cutil.DefaultSearchPath, clib.Search)
themeRoutes(r)
// $PF_SECTION_START(routes)$
moduleRoutes(r)
projectRoutes(r)
r.GET("/testbed", controller.Testbed)
r.POST("/testbed", controller.Testbed)
// $PF_SECTION_END(routes)$
r.GET("/docs", clib.Docs)
r.GET("/docs/{path:*}", clib.Docs)
r.GET("/admin", clib.Admin)
execRoutes(r)
r.GET("/admin/{path:*}", clib.Admin)
r.POST("/admin/{path:*}", clib.Admin)
r.GET("/favicon.ico", clib.Favicon)
r.GET("/robots.txt", clib.RobotsTxt)
r.GET("/assets/{_:*}", clib.Static)
r.OPTIONS("/", controller.Options)
r.OPTIONS("/{_:*}", controller.Options)
r.NotFound = controller.NotFound
clib.AppRoutesList = r.List()
p := httpmetrics.NewMetrics(util.AppKey, logger)
return fasthttp.CompressHandlerLevel(p.WrapHandler(r, true), fasthttp.CompressBestSpeed)
}