-
-
Notifications
You must be signed in to change notification settings - Fork 120
Closed
Description
Hi, first of all thanks for working on updating this tutorial.
I have been trying to follow the rails 6 version and on chapter 3, when testing via the api for the first time via curl, I noticed 2 issues:
- The path is incorrect (if using the constraint), its listed as
/api/v1/users/1
while it should be/users/1
- The subdomain constraint isn't working because doing something like
curl http://api.localhost:3000/users/1
is invalid (unless you define api.localhost on your hosts file)
What I would suggest to be able to use the subdomain constraint on local development is:
- Use lvh.me which resolves itself plus any subdomain to localhost (without user requiring to change anything on their system). For rails 6, you would just need to add
config.hosts << "api.lvh.me"
somewhere in yourdevelopment.rb
environment file.
With this you can runcurl http://api.lvh.me:3000/users/1
- Alternatively add a section on editing the system hosts file.
Metadata
Metadata
Assignees
Labels
No labels