implement authentication

This commit is contained in:
2025-04-06 21:36:03 -04:00
parent 824ca781d4
commit ccc0a58f88
2 changed files with 56 additions and 0 deletions

View File

@@ -37,6 +37,8 @@ func Start() {
})
r.Route("/messages", func(r chi.Router) {
r.Use(SessionAuthMiddleware) // Protect with authentication
r.Get("/", ListMessages)
r.Route("/{messageID}", func(r chi.Router) {
r.Use(MessageCtx) // Load message
@@ -48,6 +50,8 @@ func Start() {
})
r.Route("/users", func(r chi.Router) {
r.Use(SessionAuthMiddleware) // Protect with authentication
r.Get("/", ListUsers)
r.Route("/{userID}", func(r chi.Router) {
r.Use(UserCtx) // Load user