Setting Up the Routes
For this section, we'll need to add three routes to:
- Display the login page,
- Process the login request, and
- Process the logout request.
We'll add these new routes to the previously created userRoutes
group in routes.go
as follows:
// routes.go
userRoutes := router.Group("/u")
{
// . (existing content, not shown)
// .
userRoutes.GET("/login", showLoginPage)
userRoutes.POST("/login", performLogin)
userRoutes.GET("/logout", logout)
}