forked from insionng/zenpress
-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.go
59 lines (44 loc) · 1.84 KB
/
app.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
58
59
package main
import (
"fmt"
"github.com/astaxie/beego"
"toropress/handlers"
"toropress/handlers/root"
"toropress/models"
)
func main() {
fmt.Println("Starting...")
models.CreateDb()
beego.SetStaticPath("/static/", "static/")
beego.SetStaticPath("/archives/", "archives/")
beego.SetStaticPath("/static", "static/")
beego.SetStaticPath("/archives", "archives/")
beego.Router("/", &handlers.MainHandler{})
beego.Router("/category/:cid:int", &handlers.MainHandler{})
beego.Router("/search", &handlers.SearchHandler{})
beego.Router("/node/:nid:int", &handlers.NodeHandler{})
beego.Router("/view/:tid:int", &handlers.ViewHandler{})
beego.Router("/register", &handlers.RegHandler{})
beego.Router("/login", &handlers.LoginHandler{})
beego.Router("/logout", &handlers.LogoutHandler{})
//hotness
beego.Router("/like/:name:string/:id:int", &handlers.LikeHandler{})
beego.Router("/hate/:name:string/:id:int", &handlers.HateHandler{})
beego.Router("/new/category", &handlers.NewCategoryHandler{})
beego.Router("/new/node", &handlers.NewNodeHandler{})
beego.Router("/new/topic", &handlers.NewTopicHandler{})
beego.Router("/new/reply/:tid:int", &handlers.NewReplyHandler{})
beego.Router("/modify/category", &handlers.ModifyCategoryHandler{})
beego.Router("/modify/node", &handlers.ModifyNodeHandler{})
beego.Router("/topic/delete/:tid:int", &handlers.TopicDeleteHandler{})
beego.Router("/topic/edit/:tid:int", &handlers.TopicEditHandler{})
beego.Router("/node/delete/:nid:int", &handlers.NodeDeleteHandler{})
beego.Router("/node/edit/:nid:int", &handlers.NodeEditHandler{})
beego.Router("/delete/reply/:rid:int", &handlers.DeleteReplyHandler{})
//root routes
beego.Router("/root", &root.RMainHandler{})
beego.Router("/root-login", &root.RLoginHandler{})
beego.Router("/root/account", &root.RAccountHandler{})
beego.SessionOn = true
beego.Run()
}