-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
37 lines (29 loc) · 793 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 (
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"receipt/routes"
)
// global Echo instance
var Pecho *echo.Echo
func main() {
Pecho = echo.New()
// install logger middleware
Pecho.Use(middleware.Logger())
// install recover middleware
Pecho.Use(middleware.Recover())
// install gzip middleware
Pecho.Use(middleware.GzipWithConfig(middleware.GzipConfig{
Level: 5,
}))
// frontend static file service
// staticFile()
Pecho.GET("/ping", routes.PingHandler)
Pecho.POST("/register", routes.Register)
Pecho.POST("/login", routes.Login)
Pecho.GET("/session", routes.Session)
Pecho.POST("/content", routes.Upload)
Pecho.GET("/content", routes.GetContents)
// TODO: deploys contract
Pecho.Logger.Fatal(Pecho.Start(":1323"))
}