-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
executable file
·36 lines (27 loc) · 871 Bytes
/
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 (
"main/database"
"main/handler"
"main/middleware"
"github.com/gin-gonic/gin"
)
func main() {
database.ConnectDatabase()
router := gin.Default()
//--------------------------Basic Routes
router.GET("/articles", handler.Games())
router.GET("/articles/:aid", handler.GameById())
router.GET("/articles/:aid/comments", handler.Comments())
//--------------------------Authentication Required Routes
router.Use(middleware.CheckAuthorization())
{
router.POST("/articles/:aid/comments", handler.PostComment())
router.DELETE("/articles/:aid/comments/:cid", handler.DeleteComment())
}
//--------------------------User Routes
router.POST("/users/signup", handler.Signup())
router.POST("/users/login", handler.Login())
router.POST("/users/sudo", handler.Sudo())
router.Run(":3693")
}
//env GOOS=linux GOARCH=arm go build -o api_arm