Skip to content

Lab 11#8

Open
meeksfred wants to merge 6 commits intocodefellows-seattle-javascript-401d10:masterfrom
meeksfred:master
Open

Lab 11#8
meeksfred wants to merge 6 commits intocodefellows-seattle-javascript-401d10:masterfrom
meeksfred:master

Conversation

@meeksfred
Copy link
Copy Markdown

No description provided.

Raziyehbazargan pushed a commit to Raziyehbazargan/lab-11-12-express-api that referenced this pull request Sep 27, 2016
Comment thread lab-max/README.md
@@ -0,0 +1,91 @@
#Express API
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@meeksfred as always, great README.

Comment thread lab-max/gulpfile.js
@@ -0,0 +1,23 @@
'use strict';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@meeksfred Update this as needed - we are totally cool with you modifying this file to conform to your own workflow and any helpers that you may need. This will become more relevant as we move into database integration - but yeah, this file is to help you - so make it your own when you get the chance.

debug('user error');
res.status(err.status).send(err.name);
next();
return;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@meeksfred good use of a return to exit out of this - additionally, great use of next() to invoke the next function in the callback chain

Comment thread lab-max/lib/storage.js
return fs.unlinkProm(`${__dirname}/../data/${schemaName}/${id}.json`)
.then()
.catch( err => Promise.reject(createError(404, err.message)));
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@meeksfred although most of this was done in class - the storage module looks good!

Comment thread lab-max/model/pizza.js
if(!sauce) throw createError(400, 'expected sauce');
if(!crust) throw createError(400, 'expected crust');
if(!meat) throw createError(400, 'expected meat');
if(!cheese) throw createError(400, 'expected cheese');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@meeksfred great error handling!

Comment thread lab-max/server.js

app.listen(PORT, function(){
debug(`server up ${PORT}`);
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@meeksfred server file looks good!


require('../server.js');

var pizza = {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@meeksfred good mock data!

.send(pizza)
.end((err, res) => {
if(err) return done(err);
tempPizza = res.body;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@meeksfred any reason for this assignment?

describe('testing bad request', function(){

before( done => {
pizza.meat = '';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@meeksfred good clearing

describe('testing valid route', function(){
var tempPizza;

before( done => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@meeksfred good before and after blocks

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

Successfully merging this pull request may close these issues.

2 participants