-
Notifications
You must be signed in to change notification settings - Fork 0
/
router.go
37 lines (26 loc) · 889 Bytes
/
router.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
package main
import (
"github.com/dncrht/kwik/controllers"
"github.com/buaazp/fasthttprouter"
)
func Router() *fasthttprouter.Router {
router := fasthttprouter.New()
router.ServeFiles("/assets/*filepath", "assets")
// / root path
router.GET("/", controllers.Root)
// /edit launch edit mode from top bar
router.GET("/edit", controllers.EditRedirection)
// /search find pages
router.GET("/search", controllers.Search)
// /docs display all pages
router.GET("/docs", controllers.ShowAll)
// /docs/:title display page
router.GET("/docs/:title", controllers.Show)
// /docs/:title/edit edit page
router.GET("/docs/:title/edit", controllers.Edit)
// /docs/:title/edit edit page action
router.POST("/docs/:title/edit", controllers.EditAction)
// /docs/:title/preview preview page action
router.POST("/docs/:title/preview", controllers.PreviewAction)
return router
}