This commit is contained in:
parent
98191fd098
commit
d272fa90b4
20 changed files with 574 additions and 27 deletions
|
@ -30,6 +30,10 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
webutils "git.mstar.dev/mstar/goutils/http"
|
||||
|
||||
"git.mstar.dev/mstar/linstrom/web/public/api"
|
||||
)
|
||||
|
||||
type Server struct {
|
||||
|
@ -42,8 +46,13 @@ func New(addr string) *Server {
|
|||
w.WriteHeader(500)
|
||||
fmt.Fprint(w, "not implemented")
|
||||
})
|
||||
handler.Handle("/api/", http.StripPrefix("/api", api.BuildApiRouter()))
|
||||
handler.HandleFunc("GET /.well-known/webfinger", api.WellKnownWebfinger)
|
||||
handler.HandleFunc("GET /.well-known/nodeinfo", api.WellKnownNodeinfo)
|
||||
handler.HandleFunc("GET /nodeinfo/2.1", api.Nodeinfo)
|
||||
handler.HandleFunc("GET /errors/{name}", errorTypeHandler)
|
||||
server := http.Server{
|
||||
Handler: handler,
|
||||
Handler: webutils.ChainMiddlewares(handler, webutils.LoggingMiddleware),
|
||||
Addr: addr,
|
||||
}
|
||||
return &Server{&server}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue