-
Notifications
You must be signed in to change notification settings - Fork 5
/
server.go
33 lines (26 loc) · 801 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
package main
import (
"log"
"net/http"
"github.com/pjebs/restgate"
"github.com/urfave/negroni"
//Framework
route "./app/http"
s "./app/providers"
c "./config"
)
func main() {
app := negroni.New()
app.Use(negroni.NewRecovery())
app.Use(negroni.NewLogger())
//Add Security Credential Requirements to API routes.
//For production, keep HTTPSProtection = true
HTTPSProtection := false
if HTTPSProtection {
app.Use(restgate.New("X-Auth-Key", "X-Auth-Secret", restgate.Static, restgate.Config{HTTPSProtectionOff: false, Key: []string{c.API_ENDPOINT_KEY}, Secret: []string{c.API_ENDPOINT_SECRET}}))
}
app.Use(negroni.HandlerFunc(s.ServiceProviders)) //Initializes Service Providers
app.UseHandler(route.New())
http.Handle("/", app)
log.Fatal(http.ListenAndServe(":8000", nil))
}