Skip to content

Server URL is hardcoded all over the place #72

Open
@dimitrovs

Description

@dimitrovs

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 .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions