mirror of
https://github.com/aljazceru/satdress.git
synced 2025-12-17 21:44:21 +01:00
JSON API (#28)
Co-authored-by: Raphael <raphael.schleithoff@tum.de> Co-authored-by: Raphael <raphjaph@protonmail.com>
This commit is contained in:
11
main.go
11
main.go
@@ -95,6 +95,17 @@ func main() {
|
||||
},
|
||||
)
|
||||
|
||||
api := router.PathPrefix("/api/v1").Subrouter()
|
||||
api.Use(authenticate)
|
||||
|
||||
// unauthenticated
|
||||
api.HandleFunc("/claim", ClaimAddress).Methods("POST")
|
||||
|
||||
// authenticated routes; X-Pin in header or in json request body
|
||||
api.HandleFunc("/users/{name}", GetUser).Methods("GET")
|
||||
api.HandleFunc("/users/{name}", UpdateUser).Methods("PUT")
|
||||
api.HandleFunc("/users/{name}", DeleteUser).Methods("DELETE")
|
||||
|
||||
srv := &http.Server{
|
||||
Handler: router,
|
||||
Addr: s.Host + ":" + s.Port,
|
||||
|
||||
Reference in New Issue
Block a user