AbdallahRdf / blogging-platform-api

Blogging platform API
https://blogging-platform-api-uhuy.onrender.com/
0 stars 1 forks source link
backend blog express-js mongodb-atlas nodejs rest

Blogging Platform API

This is the backend API for a personal blog built using Node.js and Express.js, with MongoDB Atlas as the database. The API includes JWT-based authentication and role-based authorization, supporting three roles: Admin, Moderator, and User.

Hosted on Render: Blogging Platform API

Technologies Used

Features

Actions

Unauthenticated Users:

Authenticated Users:

Authentication

Public API Endpoints

For detailed information about the public API endpoints, please refer to the API Documentation.

Project Setup

Prerequisites

Installation Steps

  1. Clone the repository:

    git clone https://github.com/AbdallahRdf/blogging-platform-api.git
  2. Install dependencies:

    cd blogging-platform-api
    npm install
  3. Create a .env file with the necessary environment variables:

    PORT=Server_port_number.
    JWT_SECRET_KEY=Secret_key_for_JWT_authentication.
    MONGODB_CONNECTION_STRING=your-mongodb-connection-string
    FRONTEND_URL=URL_of_your_frontend_application_(optional)
    EMAIL_USER=Email_address_for_sending_emails
    EMAIL_APP_PASSWORD=Application_password_for_the_email_account.
    NODE_ENV=development_or_production
  4. Create an initial admin user:

    run the command below to run createAdmin.js script to create an admin user.

    npm run create-admin
  5. Start the development server:

    npm run start:dev

Contributing

If you want to contribute to this project, feel free to fork the repo and submit a pull request.