β
Created server.js
in the /src
folder: This is where the server is initialized and started.
β
Updated package.json
: Configured nodemon
to spin up on server.js
.
β
Created app
folder: Contains the main application logic, including routes and other crucial components.
β
Created router
folder: Defines all the routes.
β
Created controller
folder: Contains all the controller functions.
β
Created model
folder: Defines the user schema and model.
β
Updated app
folder: Added an error handler middleware to handle all errors.
β
Installed morgan
: Logs incoming requests and added it to the middleware.
β
Added xss-clean
package: Filters XSS requests (note: this package is out of date).
β
Added express-rate-limit
: Limits the number of requests that can be sent in a particular time frame.
β
Added http-errors
: Generates and handles HTTP errors.
β
Added dotenv
: Manages environment variables.
β
Created .env
file: Stores crucial details like MongoDB connection string.
β
Created secret.js
in src
: Manages the .env
file and makes the data available to all project files.
β
Created config/db.js
in src
: Manages the connection to the database using Mongoose and calls the function in app.js
.
β
Added getUser
route: Includes pagination, search, and limiting functionality.
β
Added getUserById
service: Created a route to get a particular user by ID.