-
Notifications
You must be signed in to change notification settings - Fork 11
/
main.go
41 lines (39 loc) · 1.33 KB
/
main.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
package main
import (
"fmt"
"github.com/imeoer/bamboo-api/ink"
"github.com/imeoer/bamboo-api/bamboo"
)
func main() {
app := ink.New()
// middleware
app.Options("*", ink.Cors)
app.Get("*", ink.Static("public"))
app.Post("*", ink.Cors)
app.Post("*", bamboo.PreHandle)
// user
app.Post("/user/login", bamboo.UserLogin)
app.Post("/user/register", bamboo.UserRegister)
app.Post("/user/config", bamboo.UserConfig)
app.Post("/user/info", bamboo.UserInfo)
app.Post("/user/timeline", bamboo.UserTimeline)
app.Post("/user/page", bamboo.UserPage)
app.Post("/user/check_token", bamboo.UserCheckToken)
// article
app.Post("/article/update", bamboo.ArticleUpdate)
app.Post("/article/list", bamboo.ArticleList)
app.Post("/article/remove", bamboo.ArticleRemove)
app.Post("/article/get", bamboo.ArticleGet)
app.Post("/article/upload", bamboo.ArticleUpload)
app.Post("/article/like", bamboo.ArticleLike)
app.Post("/article/favarite", bamboo.ArticleFavarite)
// comment
app.Post("/comment/add", bamboo.CommentAdd)
app.Post("/comment/list", bamboo.CommentList)
app.Post("/comment/remove", bamboo.CommentRemove)
// circle
app.Post("/circle/focus", bamboo.CircleFocus)
// start server
fmt.Println("Listening on 8888...")
app.Listen("0.0.0.0:8888")
}