Jonny Lab 8#15
Open
jonathanheemstra wants to merge 36 commits intocodefellows-seattle-javascript-401d12:masterfrom
Open
Jonny Lab 8#15jonathanheemstra wants to merge 36 commits intocodefellows-seattle-javascript-401d12:masterfrom
jonathanheemstra wants to merge 36 commits intocodefellows-seattle-javascript-401d12:masterfrom
Conversation
scaffold files
set up server
set up parse json file
set up parse url
set up ski data model
build router for app
set up routes on server file
set up data storage
add routes to server.js
set up delete route
set up tests
kaylynyuh
reviewed
Dec 15, 2016
| * 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. |
kaylynyuh
reviewed
Dec 15, 2016
| return; | ||
| } | ||
| }); | ||
|
|
kaylynyuh
reviewed
Dec 15, 2016
server.js
Outdated
|
|
||
| // routes.put('/api/ski-data', (req, res) => { | ||
| //TODO: add put route | ||
| // }); |
There was a problem hiding this comment.
Glad to see you were thinking about PUT- minor nitpick- just be sure to remove commented out code before pushing to the githubs!
kaylynyuh
reviewed
Dec 15, 2016
| }); | ||
| }); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
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.
kaylynyuh
reviewed
Dec 15, 2016
| }; | ||
|
|
||
| Router.prototype.route = function() { | ||
| return (req, res) => { |
There was a problem hiding this comment.
if you used a lexical arrow here it would know what this.routes is!
scaffold files for lab 9
set up routes file
add response file
successfully refactored
readme updated
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.
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.