Initial commit after restructure

This commit is contained in:
Daniel 2018-08-13 14:05:58 +02:00
commit 96ec15b39b
70 changed files with 6945 additions and 0 deletions

28
api/router.go Normal file
View file

@ -0,0 +1,28 @@
// Copyright Safing ICS Technologies GmbH. Use of this source code is governed by the AGPL license that can be found in the LICENSE file.
package api
import (
"net/http"
"github.com/gorilla/mux"
)
func NewRouter() *mux.Router {
router := mux.NewRouter().StrictSlash(true)
for _, route := range routes {
var handler http.Handler
handler = route.Handler
handler = Logger(handler, route.Name)
router.
Methods(route.Method).
PathPrefix(route.Path).
Name(route.Name).
Handler(handler)
}
return router
}