add /blogs/{blogID} and /blogs/lookup/{blogName} routes

This commit is contained in:
sam 2023-09-06 02:40:50 +02:00
parent dfc116d828
commit dd72a1f4c1
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
5 changed files with 104 additions and 1 deletions

View file

@ -4,6 +4,7 @@ import (
"git.sleepycat.moe/sam/mercury/internal/database"
"git.sleepycat.moe/sam/mercury/web/api"
"git.sleepycat.moe/sam/mercury/web/api/accounts"
"git.sleepycat.moe/sam/mercury/web/api/blogs"
"git.sleepycat.moe/sam/mercury/web/app"
"git.sleepycat.moe/sam/mercury/web/auth"
"git.sleepycat.moe/sam/mercury/web/frontend"
@ -43,5 +44,11 @@ func Routes(app *app.App) {
Get("/accounts/{accountID}", api.WrapHandlerT(accounts.GetID))
r.With(app.APIAuth(database.TokenScopeAccountsMe, false)).
Get("/accounts/@me", api.WrapHandlerT(accounts.GetMe))
blogs := blogs.New(app)
r.With(app.APIAuth(database.TokenScopeBlogsRead, true)).
Get("/blogs/{blogID}", api.WrapHandlerT(blogs.GetID))
r.With(app.APIAuth(database.TokenScopeBlogsRead, true)).
Get("/blogs/lookup/{blogName}", api.WrapHandlerT(blogs.LookupName))
})
}