Skip to content

Jonny Lab 8#15

Open
jonathanheemstra wants to merge 36 commits intocodefellows-seattle-javascript-401d12:masterfrom
jonathanheemstra:master
Open

Jonny Lab 8#15
jonathanheemstra wants to merge 36 commits intocodefellows-seattle-javascript-401d12:masterfrom
jonathanheemstra:master

Conversation

@jonathanheemstra
Copy link
Copy Markdown

Question:
I attempted to use a fat arrow => function in my object constructor in my router.js file and that continually failed. The only way I was able to get the router to work was if i used a standard function call. Why do fat arrow functions not work inside of my router file?

Observation:
Promises are something this is still really confusing to me. I am able to largely follow what is going on when passing a promise back but I am still struggling to fully understand how to create promise. I can see how promises add a really helpful layer of functionality that make callbacks more readable but they are still really confusing.

* If you run a bad `GET` method and do not pass an `id` the api will return 400.
* `DELETE`: `http DELETE localhost:<YOUR PORT NUMBER>/api/ski-data?id=<ID OF OBJECT YOU WANT TO DELETE>`
* This will return a header with a status code of 204.
* The object deleted will be removed for the database.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good job on the docs!

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.

Nice!

server.js Outdated

// routes.put('/api/ski-data', (req, res) => {
//TODO: add put route
// });
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Glad to see you were thinking about PUT- minor nitpick- just be sure to remove commented out code before pushing to the githubs!

});
});
});
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The PORT you are having your server listen on should be the same PORT you are using for your tests. This way, if someone clones your code and runs gulp or mocha the tests will pass. For instance, these all failed on my machine until I changed them to the PORT your server is looking for. If you have PORT as an environmental variable in your .bashrc I would remove it.

};

Router.prototype.route = function() {
return (req, res) => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

if you used a lexical arrow here it would know what this.routes is!

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