Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about routing logic #80

Open
Fweddi opened this issue Aug 16, 2019 · 2 comments
Open

Question about routing logic #80

Fweddi opened this issue Aug 16, 2019 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@Fweddi
Copy link

Fweddi commented Aug 16, 2019

I'm interested in the logic of the following lines. Why would you change the url, rather than keeping the same endpoint and serving up the file?

if (req.url === "/") {
      req.url = "/public/indexProtected.html";
    }

Router.js, lines 9-11

@Fweddi Fweddi added the question Further information is requested label Aug 16, 2019
@crianonim
Copy link
Contributor

This way we don't need to have a separate handlers just for our homes. They will be served as other public files. It is acting as if '/' were a 'link' to actual files. We have no other reasons to create separate handlers for our '/'. Also depending on wheter you are logged in or not it links to different routes. Not sure if it explain anything... Sorry.

@crianonim crianonim self-assigned this Aug 16, 2019
@samjam48
Copy link
Collaborator

When I was working with Lungs team they were doing this as well. I thought editing the variable passed in was wrong as not pure function and then implemented it differently.

It seems like the groups learnt to do it this way form a workshop or something and perhaps should be corrected (if it's a problem)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants