app.js receives all routes from routes/index.js & prepends the URL path to whatever we specify
app.js catches all errors thrown in controllers and sends back 404 errors
Associated Product Ticket
Process
Without this, routes will/may not run properly since app.js is, you know, the app
Without error handling, we will be terrible programmers. Here's a non-exhaustive list of errors to handle:
404: request made does not exist
500: the app/database broke
All controllers should call next(err) when an Error is thrown
Expected Result
Starting up the app (node app.js) & navigating to a completed MVC route in the browser, should return the requested data. Navigating to an incomplete MVC route or nonexistent route should return the appropriate error.
Context
app.js
receives all routes fromroutes/index.js
& prepends theURL
path to whatever we specifyapp.js
catches all errors thrown incontrollers
and sends back404
errorsAssociated Product Ticket
Process
app.js
is, you know, the app404
: request made does not exist500
: the app/database brokecontrollers
should callnext(err)
when anError
is thrownExpected Result
Starting up the app (
node app.js
) & navigating to a completed MVC route in the browser, should return the requested data. Navigating to an incomplete MVC route or nonexistent route should return the appropriate error.