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

Return whole created example #36

Open
oliverjam opened this issue Apr 17, 2020 · 0 comments
Open

Return whole created example #36

oliverjam opened this issue Apr 17, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request
Projects

Comments

@oliverjam
Copy link

function createExample(example) {
return db
.query(
"INSERT INTO examples(owner_id, language, title, example) VALUES($1, $2, $3, $4) RETURNING id",
[example.user_id, example.language, example.title, example.example]
)

It's usually a good idea to return the newly created resource from a POST request. That way a client app can show the user exactly what new thing was created. Returning the ID is good, but it means the app has to make another network request to get the rest of the properties, which is slow/inefficient.

@oliverjam oliverjam added the enhancement New feature or request label Apr 17, 2020
@Roger-Heathcote Roger-Heathcote self-assigned this Apr 17, 2020
@Alexreid95 Alexreid95 added this to To do in week7-CRaKT via automation Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
week7-CRaKT
  
To do
Development

No branches or pull requests

2 participants