Nikko Lab 12#12
Open
npisciotti1 wants to merge 4 commits intocodefellows-javascript-401d13:masterfrom
Open
Conversation
jalleng
reviewed
Mar 2, 2017
| 'use strict'; | ||
|
|
||
| const createError = require('http-errors'); | ||
| const debug = require('debug'); |
There was a problem hiding this comment.
Don't forget to add the extension on to this. ('guitar:error-middleware');
jalleng
reviewed
Mar 2, 2017
| const Guitar = module.exports = function(name, type, make) { | ||
| if(!name) throw createError(400, 'bad request'); | ||
| if(!type) throw createError(400, 'bad request'); | ||
| if(!make) throw createError(400, 'bad request'); |
There was a problem hiding this comment.
You could make these a little more explicit. Think of the end user and how an error could be more useful to them.
jalleng
reviewed
Mar 2, 2017
| .catch( err => Promise.reject(createError(404, err.message))) | ||
| .then( guitar => { | ||
| for (var prop in guitar) { | ||
| if(_guitar[prop]) guitar[prop] = _guitar[prop]; |
There was a problem hiding this comment.
This might allow the user to change the id on their guitar object. Which could mess up how it is being stored in your db. It is a good idea to ignore attempts to update the id by continuing if (prop === 'id').
jalleng
reviewed
Mar 2, 2017
|
|
||
| const Router = require('express').Router; | ||
| const jsonParser = require('body-parser').json(); | ||
| const debug = require('debug'); |
There was a problem hiding this comment.
You should add on the debug extension here ('guitar:guitar-router')
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.