abuiles / ember-cli-101-errata

18 stars 4 forks source link

Resource Naming #248

Closed Angelfire closed 9 years ago

Angelfire commented 9 years ago

Pag: 22 adding a new friend

By convention, the URL for adding a new resource is /resource_name/new. For editing a resource, use /resource_name/:resource_id/edit and for showing a resource, use /resource/:resource_id.

But if we look documentation, convention should be:

POST /users -> create
GET /users -> index
GET /users/:id -> view

Or am I doing something wrong?

abuiles commented 9 years ago

@Angelfire The first ones refer to your apps URL, it will manage the flow of it, doesn't necessarily match to API URLs, so inside /resource_name/new you might do a POST to create a new user.

/users/new ---->   POST /users 
/users/        ----> GET /users 
/users/:user_id --> GET /users/:id
/users/:users_id/edit --> PATCH/PUT /users/:id

Feel free to reopen if it doesn't makes sense :)