Skip to content

Node.js RESTful API project for managing educational resources in an academy. It offers full CRUD functionality for users , courses , bootcamps and reviews with Express.js for routing and MongoDB for storage.

License

Notifications You must be signed in to change notification settings

carpodok/dev-academy-rest-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dev Academy REST API

Node.js RESTful API project for managing educational resources in an academy. It offers full CRUD functionality for users , courses , bootcamps and reviews with Express.js for routing and MongoDB for storage.

Endpoints

Below is an overview of the available endpoints and their functionalities.

  • To explore the Swagger UI schema and view available endpoints, navigate to http://localhost:3000/api-docs after running the server.
  • You can also test these endpoints via this Postman collection
auth bootcamps courses reviews users

Key Features

This project implements the following key features to ensure a robust, secure, and scalable web application:

  • JWT-Based Authentication: Secure user authentication using JSON Web Tokens (JWT) to manage user sessions.
  • Password Hashing: Secure password storage with hashing using the bcryptjs package.
  • Role-Based Access Control (RBAC): Authorization system to manage access based on user roles, ensuring secure data handling.
  • Password Recovery: Full password recovery system, including both "reset password" and "forgot password" functionalities.
  • Email Notifications: Automated email notifications for password recovery using the nodemailer package.
  • Server-Side Validation: Input validation using the express-validator package to ensure data integrity and security.
  • Advanced MongoDB Queries: Efficient data retrieval and manipulation using the MongoDB Aggregation Framework.
  • Pagination: Implemented pagination for efficient result retrieval in larger datasets.
  • Image Upload: Secure image uploading functionality using the express-fileupload package.
  • SEO-Friendly URLs: Convert text into URL-friendly slugs using the slugify package.
  • Rate Limiting: Protect the application from abuse by implementing rate limiting using the express-rate-limit package.
  • Mongoose Hooks: Utilized Mongoose pre and post hooks for automating tasks such as data validation and modifications before saving or retrieving documents.

Installation

  1. Clone the repository
  git clone https://github.com/carpodok/dev-academy-rest-api.git
  1. Navigate to the project directory:
 cd dev-academy-rest-api
  1. Install required dependencies
 npm install

Configuration

  1. Creat a .env file on the root of the project and add the following environment variables. To set up email host informations visit Mailtrap and create your account.
NODE_ENV=development
PORT=3000
MONGO_URI=<your-mongo-uri>

FILE_UPLOAD_PATH= ./public/uploads
MAX_FILE_UPLOAD=1000000

JWT_SECRET=<your-jwt-secret>
JWT_EXPIRE=30d
JWT_COOKIE_EXPIRE=30

// Set up with your own configurations
SMTP_HOST=sandbox.smtp.mailtrap.io
SMTP_PORT=
SMTP_EMAIL=
SMTP_PASSWORD= 
FROM_EMAIL=noreply@devacademy.io
FROM_NAME=Dev Academy

  1. To seed the database with users, bootcamps, courses and reviews with data from the "_data" folder, run
# Destroy all data
node seeder -d

# Import all data
node seeder -i

Running the Application

  1. To start the server, run the following command on the root of the project path;
npm start

For the development purpose;

npm run dev
  1. The application will be running on http://localhost:3000

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or suggestions.

License

This project is licensed under the MIT License.

About

Node.js RESTful API project for managing educational resources in an academy. It offers full CRUD functionality for users , courses , bootcamps and reviews with Express.js for routing and MongoDB for storage.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published