-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.go
46 lines (36 loc) · 1.19 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
46
package main
// @title HMS MCAT API
// @version 1.0
// @description API for the HMS MCAT
// @termsOfService http://swagger.io/terms/
// @contact.name API Support
// @contact.email slawler@dewberry.com
// @host localhost:5900
import (
"github.com/USACE/mcat-hms/config"
_ "github.com/USACE/mcat-hms/docs"
"github.com/USACE/mcat-hms/handlers"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
echoSwagger "github.com/swaggo/echo-swagger"
)
func main() {
// Connect to backend services
appConfig := config.Init()
// Instantiate echo
e := echo.New()
e.Use(middleware.Logger())
e.Use(middleware.Recover())
// HealthCheck
e.GET("/ping", handlers.Ping(appConfig.FileStore))
// Swagger
e.GET("/swagger/*", echoSwagger.WrapHandler)
// hms endpoints
e.GET("/index", handlers.Index(appConfig.FileStore))
e.GET("/isamodel", handlers.IsAModel(appConfig.FileStore))
e.GET("/isgeospatial", handlers.IsGeospatial(appConfig.FileStore))
e.GET("/modeltype", handlers.ModelType(appConfig.FileStore))
e.GET("/modelversion", handlers.ModelVersion(appConfig.FileStore))
e.GET("/geospatialdata", handlers.GeospatialData(appConfig.FileStore))
e.Logger.Fatal(e.Start(appConfig.Address()))
}