admin/api: use gorilla/mux instead of Go router
This commit is contained in:
parent
3e74f5f9ef
commit
173dafa69e
18 changed files with 643 additions and 720 deletions
17
admin/api/events.go
Normal file
17
admin/api/events.go
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"srs.epita.fr/fic-server/libfic"
|
||||
)
|
||||
|
||||
func init() {
|
||||
router.Path("/events/").Methods("GET").HandlerFunc(apiHandler(getEvents))
|
||||
}
|
||||
|
||||
func getEvents(args map[string]string, body []byte) (interface{}, error) {
|
||||
if evts, err := fic.GetEvents(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return evts, nil
|
||||
}
|
||||
}
|
||||
Reference in a new issue