📀 Recordshop 💿
Express Mongoose backend project
The recordshop has endpoints for users, orders and records, that our users will use to send different kinds of requests (GET, POST, DELETE, etc).
Only backend. Just the POST /record
has a form for the file upload with multer in the frontend.
This project includes:
✔️ a seeding script to populate our database with a set of test data npm package chance
✔️ a purge script to delete all documents from our database
✔️ Error Handling Middleware from Express
✔️ CORS Middleware
✔️ validation / sanitation User npm package express-validator
✔️ password hashing with crypto (built in node module)
✔️ jsonwebtoken npm package jsonwebtoken
✔️ upload cover images for records with npm package multer
✔️ User routes are protected. User must authenticate and can only DELETE and PUT and on /user/:id
after authentication.
POST on /user
is open to everyone
GET on /user
only allowed for admins
Relationships
✔️ Recordschema has an embedded Imageschema (it looks cleaner)
✔️ Orderschema has got a reference to the Recordschema