-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserver.go
49 lines (39 loc) · 1006 Bytes
/
server.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
46
47
48
49
package main
import (
"net/http"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
func main() {
e := echo.New()
//e.Use(middleware.Logger())
e.Use(middleware.Recover())
e.Use(middleware.CORS())
e.GET("/", index)
db := dbPool()
e.GET("v2/latest", func(c echo.Context) error {
return v2_latest(c, db)
})
e.GET("v2/alerts", func(c echo.Context) error {
return v2_alerts(c, db)
})
e.GET("json/last_price", func(c echo.Context) error {
return v1_json_last_price(c, db)
})
e.GET("v2/evolution.json", func(c echo.Context) error {
return dolar_evolution_json(c, db)
})
e.GET("v2/historical", func(c echo.Context) error {
return v2_historical(c, db)
})
e.GET("v2/evolution.csv", func(c echo.Context) error {
return dolar_evolution_csv(c, db)
})
e.GET("data/json/currency.json", func(c echo.Context) error {
return currency(c, db)
})
e.Logger.Fatal(e.Start(":8080"))
}
func index(c echo.Context) error {
return c.String(http.StatusOK, "OK")
}