mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
21 lines
645 B
Go
21 lines
645 B
Go
package main
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/julienschmidt/httprouter"
|
|
)
|
|
|
|
func (app *application) routes() *httprouter.Router {
|
|
router := httprouter.New()
|
|
|
|
router.NotFound = http.HandlerFunc(app.notFoundResponse)
|
|
router.MethodNotAllowed = http.HandlerFunc(app.methodNotAllowedResponse)
|
|
|
|
router.HandlerFunc(http.MethodGet, "/v1/commands/:name", app.showCommandHandler)
|
|
router.HandlerFunc(http.MethodPost, "/v1/commands", app.createCommandHandler)
|
|
router.HandlerFunc(http.MethodPatch, "/v1/commands/:name", app.updateCommandHandler)
|
|
router.HandlerFunc(http.MethodDelete, "/v1/commands/:name", app.deleteCommandHandler)
|
|
return router
|
|
}
|