-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
36 lines (28 loc) · 964 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 (
"github.com/allochi/sample-gin/handlers"
"github.com/gin-gonic/gin"
)
func main() {
router := gin.Default()
router.GET("/", handlers.Home)
router.LoadHTMLGlob("templates/*")
// add `data` section to API
// -------------------------
data := router.Group("/data")
data.GET("/quotes", handlers.GetQuotes)
data.GET("/tenders", handlers.GetTenders)
data.GET("/reports/:id/sources", handlers.GetReportSources)
// check echo's multilevel params
// ------------------------------
router.GET("/name/first/:first/last/:last", handlers.GetFullName)
// router.GET("/name/:first/:last", handlers.GetFullName)
// add `secrets` section to API with authentication
// ------------------------------------------------
secrets := router.Group("/secrets")
secrets.Use(handlers.Authenticate())
secrets.GET("/accounts", handlers.GetAccounts)
// Postgrest proxy
router.Any("/psql/*url", handlers.PostgrestProxy)
router.Run(":3300")
}