refactor(app): 🩺 enhance routing and add health check

master
Xeronith 2022-08-19 17:36:39 +04:30
rodzic c3af1bfd6a
commit 224ebd012f
3 zmienionych plików z 34 dodań i 19 usunięć

Wyświetl plik

@ -26,25 +26,7 @@ func main() {
app := server.New()
app.SetStorageProvider(storage)
app.SetLogger(logger)
app.Bind(
routes.Root,
routes.Profile,
routes.Signup,
routes.Login,
routes.GetProfile,
routes.UpdateProfile,
routes.WebFinger,
routes.User,
routes.Message,
routes.InboxPost,
routes.InboxGet,
routes.OutboxPost,
routes.OutboxGet,
routes.Followers,
routes.Follow,
routes.Authorize,
)
app.Bind(routes.All...)
app.Listen(fmt.Sprintf(":%s", config.PORT))
}

Wyświetl plik

@ -0,0 +1,23 @@
package routes
import "contracts"
var All = []contracts.IRoute{
Health,
Root,
Profile,
Signup,
Login,
GetProfile,
UpdateProfile,
WebFinger,
User,
Message,
InboxPost,
InboxGet,
OutboxPost,
OutboxGet,
Followers,
Follow,
Authorize,
}

Wyświetl plik

@ -0,0 +1,10 @@
package routes
import (
"contracts"
"server/route"
)
var Health = route.New(contracts.HttpGet, "/health", func(x contracts.IContext) error {
return x.Nothing()
})