major refactoring of the api
This commit is contained in:
1 parent
d4f7dc57fc
commit
f0628e4682
38 files changed
+821
-367
No files matched your search
+54
@@ -0,0 +1,54 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/didiercrunch/doormanserver/simpleapi"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func Create() http.Handler {
|
||||
serverSpecification := &simpleapi.Endpoint{
|
||||
"/server",
|
||||
"Get the server specification.",
|
||||
"GET",
|
||||
GetServerSpecification,
|
||||
}
|
||||
|
||||
createDoorman := &simpleapi.Endpoint{
|
||||
"/doormen",
|
||||
"Create a new doorman.",
|
||||
"POST",
|
||||
CreateDoorman,
|
||||
}
|
||||
|
||||
allDoorman := &simpleapi.Endpoint{
|
||||
"/doormen",
|
||||
"Get the list of all the public doormen.",
|
||||
"GET",
|
||||
GetAllDoormen,
|
||||
}
|
||||
|
||||
doorman := &simpleapi.Endpoint{
|
||||
"/doormen/{id}",
|
||||
"Get the doorman.",
|
||||
"GET",
|
||||
GetDoorman,
|
||||
}
|
||||
|
||||
updateDoorman := &simpleapi.Endpoint{
|
||||
"/doormen/{id}",
|
||||
"Update the doorman with new probabilities.",
|
||||
"PUT",
|
||||
UpdateDoorman,
|
||||
}
|
||||
|
||||
api := simpleapi.New(
|
||||
"/api",
|
||||
serverSpecification,
|
||||
createDoorman,
|
||||
allDoorman,
|
||||
doorman,
|
||||
updateDoorman,
|
||||
)
|
||||
|
||||
return api
|
||||
}
|
||||
Reference in new issue
Block a user