-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
36 lines (33 loc) · 1.16 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
package main
import (
"fmt"
"github.com/DRJ31/tiebarankgo/config"
"github.com/DRJ31/tiebarankgo/router"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/compress"
"github.com/gofiber/fiber/v2/middleware/cors"
)
func InitRouter(app *fiber.App) {
app.Get("/api/v2/tieba/users", router.GetUsers)
app.Get("/api/v2/tieba/event", router.GetEvent)
app.Get("/api/v2/tieba/anniversary", router.GetAnniversaries)
app.Get("/api/v2/tieba/events", router.GetEvents)
app.Get("/api/v2/tieba/post", router.GetOnePost)
app.Get("/api/v2/tieba/posts", router.GetMultiplePosts)
app.Get("/api/v2/tieba/user", router.FindUsers)
app.Get("/api/wallpaper", router.GetWallpaper)
//app.Get("/api/v2/tieba/distribution", router.GetDist)
app.Get("/api/v2/tieba/income", router.GetIncome)
app.Post("/api/v2/tieba/user", router.GetUser)
//app.Post("/api/v2/tieba/rank", router.GetRank)
app.Post("/api/v2/tieba/post", router.InsertPostInfo)
//app.Post("/api/v2/tieba/users", router.InsertUsers)
}
func main() {
app := fiber.New()
app.Use(cors.New())
app.Use(compress.New())
InitRouter(app)
cf := config.GetConfig()
_ = app.Listen(fmt.Sprintf("%v:%v", cf.Host, cf.Port))
}