You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// The following 2 `app.use`'s MUST follow ALL your routes/middlewareapp.use(notFound)app.use(errorHandler)functionnotFound(req,res,next){res.status(404).send({error: 'Not found!',status: 404,url: req.originalUrl})}// eslint-disable-next-linefunctionerrorHandler(err,req,res,next){console.error('ERROR',err)conststack=process.env.NODE_ENV!=='production' ? err.stack : undefinedres.status(500).send({error: err.message, stack,url: req.originalUrl})}
Session 1 Stretch Goals
Add and configure eslint to your client application: instructions
Create the Categories table (if you didn’t during class) using sequelize migrations
Use the lesson video as a guide
Create the Products table using sequelize migrations
NOTE: I initially screwed up these directions for those of you using create react app. I have added a video below walking through how to fix and install correctly. If you are starting fresh, you can follow the section below and/or watch the final few minutes of the video.
Applications bootstrapped with the create-react-app tool already have eslint intalled under the hood. The configuration is hidden from us, but you can actually add your own eslint rules quite easily.
Create an .eslintrc.js file in the /src folder of your client.
Add rules so that you are extending the react-app base configuration.
Customize your rules as needed (for indentation, semicolons, etc.)
Here is an example .eslintrc.js file that you can use as a template:
If you like using fat arrow functions for implicitly binding class methods, add the following line near the top of your eslintrc file:
"parser": "babel-eslint",
NOTE: create-react-app applications come with babel-eslint already installed. If you are not using CRA you must install it manually as a dev dependency:
[{"id": 1,"name": "Awesome Shirt","description": "Sapiente ut sed labore. Omnis fuga exercitationem explicabo omnis laboriosam. Minima eum consequuntur et illum.","price": 1500,"img_url": "http://lorempixel.com/640/480","category_id": 1},{"id": 2,"name": "Amazing Shorts","description": "Enim voluptatum excepturi laboriosam quis. Consequuntur perferendis consequatur sed corporis. Itaque rerum aliquam ut tempora perferendis.","price": 2500,"img_url": "http://lorempixel.com/640/480","category_id": 1},{"id": 3,"name": "Mousepad","description": "Suscipit molestias et nobis quo et voluptatibus voluptatum excepturi. Labore et et. Id aliquam sed sed dolor voluptas nihil accusamus.","price": 1000,"img_url": "http://lorempixel.com/640/480","category_id": 2},{"id": 4,"name": "10 Pack HDMI Cords","description": "Vero qui sapiente totam quo voluptatum aut iste odit maiores. Est est dicta. Commodi aperiam rerum vel. Voluptatem itaque tenetur odio voluptate exercitationem eum. Ut minima autem quam minus quasi aperiam.","price": 5000,"img_url": "http://lorempixel.com/640/480","category_id": 2},{"id": 5,"name": "Beautiful Bookshelf","description": "Velit temporibus quisquam voluptas reprehenderit et illo qui. Voluptas ad suscipit harum amet sit veritatis tenetur. Eveniet pariatur non consequatur quia id voluptates ad. Quaerat debitis et architecto dolore.","price": 7500,"img_url": "http://lorempixel.com/640/480","category_id": 3},{"id": 6,"name": "Da Best Desk","description": "Libero est nisi. Omnis temporibus aliquid ea repudiandae et. Id minima aliquid aliquam eaque sed eos. Sunt blanditiis ducimus praesentium maxime odit. Voluptatum quia non enim unde non illo.","price": 10000,"img_url": "http://lorempixel.com/640/480","category_id": 3}]
it('tests something but must wait for async',(done)=>{process.nextTick(()=>{// Updates to state should be reflected in here// Write expectations...done()})})
it('tests something but must wait for async',(done)=>{process.nextTick(()=>{// Updates to state should be reflected in here// Write expectations...done()})})