-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.go
35 lines (29 loc) · 830 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
package main
import (
"github.com/prest/adapters/postgres"
"github.com/prest/cmd"
"github.com/prest/config"
"github.com/prest/config/router"
"github.com/prest/middlewares"
"github.com/structy/structbase/auth"
"github.com/structy/structbase/middleware"
"github.com/urfave/negroni"
)
func main() {
config.Load()
// Load Postgres Adapter
postgres.Load()
// pREST middlewares
middlewares.MiddlewareStack = []negroni.Handler{
negroni.Handler(negroni.NewRecovery()),
negroni.Handler(negroni.NewLogger()),
negroni.Handler(middlewares.HandlerSet()),
negroni.Handler(negroni.HandlerFunc(middleware.WhiteMiddleware)),
negroni.Handler(negroni.HandlerFunc(middleware.RuleMiddleware)),
}
// pREST routes
r := router.Get()
r.HandleFunc("/auth", auth.Handler).Methods("POST")
// Call pREST cmd
cmd.Execute()
}