mirror of
https://github.com/safing/portbase
synced 2025-09-14 09:09:50 +00:00
Start api revamp
This commit is contained in:
parent
6bee0bf2d7
commit
b246453a83
16 changed files with 452 additions and 45 deletions
28
api/old/router.go
Normal file
28
api/old/router.go
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue