Solution for a challenge from Devchallenges.io.
- express generator
- bcrypt
- cookie-parser
- cors
- express
- jsonwebtoken
- mongoose
This application/site was created as a submission to a DevChallenges challenge. The challenge was to build an application to complete the given user stories.
- Categories have to be created before Items - debatable if category should belong to Item model versus a model of its own.
- Categories plus populate to get all items - versus getting categories and items separately
- List should be changeable if same day? - how should state change ?
- JWT protection for most routes - getting Items not protected and getting Categories not protected
- Users route is not required.
- Statistics doesn't require a route ?
- Problems if you delete a category - item will be linked non-existent category - have to delete item as well
- Same if you delete an item have to remove it from category array
- Guidelines - no deletion of categories or items - both can be added only
- Cross referencing models might be overkill here.
- Design choice - add quantity to item model versus list model
- Need user attached to items?
- Problem with making list name unique - different users cannot have same list name
To clone and run this application, you'll need Git and Node.js (which comes with npm) installed on your computer. From your command line:
# Clone this repository
$ git clone https://github.com/jdegand/shoppingify-backend.git
# Install dependencies
$ npm install
# Add env variables (PORT, MONGO_URI, REFRESH_TOKEN_SECRET, ACCESS_TOKEN_SECRET) and connect to mongo
# Run the app
$ npm start
- Github - shoppingList controller - got an idea from this implementation
- DevDojo - shopping cart
- Stack Overflow - mongoose callback hell
- HackMD - express get with route & query params
- Stack Overflow - routes conflict
- Stack Overflow - how to get query string vairables
- Stack Overflow - access parameters in express
- Stack Overflow - populate nested array in mongoose