How to change the URL of a subsite in Yesod?

Can I rename the endpoints of a child site to Yesod?

For example, instead of using the provided / login or / email / register from yesod-auth , I want to call them "/ entrar" and "/ cadastrar" (their counterparts are PT-BR, respectively).

The only thing I was able to do was set mine stack.yamlto use the modified local copy yesod-auth, but I wonder if there is a better approach.

+6
source share
1 answer

Currently, the data type YesodAuthdoes not provide a way to change these routes, so you have two options, as far as I know:

  • Make a local copy yesod-authand modify it according to your needs (which you know correctly)

  • Specify the routes you want in config/routes, and the handler for each of them, which will be redirected to the routes yesod-auth:

Config / Routes

/entrar MyauthEntrarR GET

SRC / Handler / Myauth

getMyauthEntrar :: Handler Html

getMyauthEntrar = redirect LoginR
+2
source

All Articles