-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
45 lines (36 loc) · 1.45 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
42
43
44
45
package main
import (
"github.com/tomasmiguez/hillchart-server/handlers"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
)
func main() {
router := gin.Default()
router.Use(cors.New(cors.Config{
// AllowOrigins: []string{"*"},
AllowAllOrigins: true,
AllowMethods: []string{"GET", "POST", "PATCH", "DELETE"},
AllowHeaders: []string{"Origin", "Content-Type"},
}))
router.POST("/hillcharts", handlers.CreateHillchart)
router.GET("/hillcharts", handlers.GetHillcharts)
router.GET("/hillcharts/:id", handlers.GetHillchart)
router.PATCH("/hillcharts/:id", handlers.UpdateHillchart)
router.DELETE("/hillcharts/:id", handlers.DeleteHillchart)
router.POST("/frames", handlers.CreateFrame)
router.GET("/frames", handlers.GetFrames)
router.GET("/frames/:id", handlers.GetFrame)
router.PATCH("/frames/:id", handlers.UpdateFrame)
router.DELETE("/frames/:id", handlers.DeleteFrame)
router.POST("/scopes", handlers.CreateScope)
router.GET("/scopes", handlers.GetScopes)
router.GET("/scopes/:id", handlers.GetScope)
router.PATCH("/scopes/:id", handlers.UpdateScope)
router.DELETE("/scopes/:id", handlers.DeleteScope)
router.POST("/frame-scopes", handlers.CreateFrameScope)
router.GET("/frame-scopes", handlers.GetFrameScopes)
router.GET("/frame-scopes/:id", handlers.GetFrameScope)
router.PATCH("/frame-scopes/:id", handlers.UpdateFrameScope)
router.DELETE("/frame-scopes/:id", handlers.DeleteFrameScope)
router.Run("localhost:3000")
}