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

Server URL is hardcoded all over the place #72

Open
dimitrovs opened this issue Jul 3, 2016 · 1 comment
Open

Server URL is hardcoded all over the place #72

dimitrovs opened this issue Jul 3, 2016 · 1 comment

Comments

@dimitrovs
Copy link

If you look at: signup.ts, login.ts, home.ts you see the API URL is hardcoded everywhere:

http://localhost:3001/users
http://localhost:3001/sessions/create
http://localhost:3001/api/random-quote
http://localhost:3001/api/protected/random-quote

You may argue that it doesn't matter, because it's just a "sample" app and users won't be deploying it anywhere, but the truth is hardcoding API URL like this is just bad design. You should have one variable defined in a common place with the API host then use relative paths everywhere else. Otherwise the incentive is too high for the novice user to just replace localhost:3001 with their domain and build a production app with this bad practice. In fact, there already is an issue asking how to do exactly that #52 .

@chenkie
Copy link
Contributor

chenkie commented Jul 4, 2016

Hardcoding the URL isn't ideal and you're right, it's just a sample app which is why :)

Want to send a PR to centralize the URL?

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

No branches or pull requests

2 participants