-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
32 lines (25 loc) · 782 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
package main
import (
"github.com/aristotelis79/Jsonzable/controllers"
"github.com/savsgio/atreugo/v10"
"github.com/valyala/fasthttp"
)
func main() {
server := configServer()
registerRoutes(server)
if err := server.ListenAndServe(); err != nil {
panic(err)
}
}
func configServer() *atreugo.Atreugo {
config := atreugo.Config{Addr: "127.0.0.1:8000"}
server := atreugo.New(config)
return server
}
func registerRoutes(server *atreugo.Atreugo) {
baseControllerPath := "/base"
server.Path(fasthttp.MethodGet, baseControllerPath, controllers.GET)
server.Path(fasthttp.MethodPost, baseControllerPath, controllers.POST)
server.Path(fasthttp.MethodPut, baseControllerPath, controllers.PUT)
server.Path(fasthttp.MethodDelete, baseControllerPath, controllers.DELETE)
}