Skip to content

Fix #37 - Authenticated User Routes #54

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

Closed
wants to merge 1 commit into from
Closed

Fix #37 - Authenticated User Routes #54

wants to merge 1 commit into from

Conversation

ademars94
Copy link

Fix #37: Pull code for POST '/users' out from authenticed routes to allow new users to sign up without already being users (this is more realistic). GET '/users' is still protected. Change content-type to Content-Type in server.js

WebStorm trimmed some whitespace too.

… allow new users to sign up without already being users (this is more realistic). `GET '/users'` is still protected. Change `content-type` to `Content-Type` in `server.js`
@chris-sev
Copy link
Member

I see the value in this, but I think that this would better be solved by creating an auth section of the API to handle registrations.

The users API will still need the authenticated POST /users route for admins that want to create users from the dashboard.

I'd recommend creating unauthenticated routes in a new app/routes/api.auth.js or app/routes/auth.js :

/api/auth/login
/api/auth/register

@ademars94
Copy link
Author

I think admin users may be outside of the scope of this chapter. Also, breaking the routes out into different files may cause confusion for some of those following along in the book. Is the book updated alongside the repo? If it is, I think you're right about creating a separate file for registrations. Otherwise I think that might make the code in the repo too different from the code in the book for beginners. What do you think?

@chris-sev
Copy link
Member

Yea I want to keep the code in the repo the same as the book. This is a great exercise to go beyond the book curriculum, but you're right; it's better for learning to keep it the way it is.

@ademars94 ademars94 closed this Apr 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants