feat(router): handle /login and /register routes

This commit is contained in:
Guz
2025-06-06 16:33:24 -03:00
parent a52caf6580
commit 56e2214311
2 changed files with 16 additions and 0 deletions

View File

@@ -90,10 +90,14 @@ func (router *router) setup() http.Handler {
r.Use(exception.PanicMiddleware())
r.Use(exception.Middleware())
userController := newUserController(router.userService, router.templates, router.assert)
r.Handle("/assets/", http.StripPrefix("/assets/", http.FileServerFS(router.assets)))
r.HandleFunc("/dashboard/", router.dashboard)
r.HandleFunc("/login/{$}", userController.login)
r.HandleFunc("/register/{$}", userController.register)
return r
}

View File

@@ -16,6 +16,18 @@ type userController struct {
service *service.UserService
}
func newUserController(
service *service.UserService,
templates templates.ITemplate,
assert tinyssert.Assertions,
) userController {
return userController{
assert: assert,
templates: templates,
service: service,
}
}
func (c userController) login(w http.ResponseWriter, r *http.Request) {
c.assert.NotNil(c.templates)
c.assert.NotNil(c.service)