kopia lustrzana https://github.com/reiver/greatape
refactor(app): 🩺 enhance routing and add health check
rodzic
c3af1bfd6a
commit
224ebd012f
|
@ -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))
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
}
|
|
@ -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()
|
||||
})
|
Ładowanie…
Reference in New Issue