-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathmain.go
More file actions
34 lines (23 loc) · 711 Bytes
/
main.go
File metadata and controls
34 lines (23 loc) · 711 Bytes
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
package main
import (
"log"
"github.com/labstack/echo"
"github.com/labstack/echo/middleware"
)
func main() {
e := echo.New()
e.HideBanner = true
e.Pre(middleware.RemoveTrailingSlash())
e.Use(middleware.CORS())
e.Use(middleware.Recover())
e.Use(middleware.Logger())
e.Use(middleware.GzipWithConfig(middleware.GzipConfig{Level: 9}))
e.GET("/", routeHome)
e.POST("/:index/:type/_doc/:id", routeIndex)
e.POST("/:index/:type/_docs", routeBatchIndex)
e.GET("/:index/:type/_doc/:id", routeGet)
e.POST("/:index/:type/_aggregate/:field/:func", routeAggregate)
e.POST("/:index/:type/_search", routeSearch)
e.DELETE("/:index/:type/_doc/:id", routeDelete)
log.Fatal(e.Start(*flagListenAddr))
}