-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
37 lines (29 loc) · 845 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
37
package main
import (
"os"
"github.com/gin-gonic/gin"
api "github.com/tcc-denis-raul/Projeto-api/api"
)
var defaultPort = "5000"
func main() {
/*Port*/
port := os.Getenv("PORT")
if port == "" {
port = defaultPort
}
router := gin.Default()
/*Route*/
router.GET("/", api.Hello)
router.GET("/types/courses", api.GetTypeCourses)
router.GET("/courses", api.GetCourses)
router.GET("/courses/questions", api.GetQuestions)
router.GET("/users", api.GetUser)
router.GET("/users/profile", api.GetUserPreferences)
router.GET("/course/detail", api.GetDetailCourse)
router.POST("/indicate/course", api.IndicateCourse)
router.POST("/course/feedback", api.Feedback)
router.POST("/users", api.CreateUser)
router.POST("/users/update", api.UpdateUser)
router.POST("/users/profile", api.SaveUserPreferences)
router.Run(":" + port)
}