Git Product home page Git Product logo

food-donation-and-supplies-management-backend-6's Introduction

L2B2-Frontend-Path-Assignment-6-Server-Starter-Pack

Installation:

  1. Clone the repository.
  2. Install dependencies using npm install.
  3. Rename .env.example to .env.
  4. Run the server using npm run dev.

Before Pushing Code:

  1. Before pushing your code to the remote repository, ensure that you have run the following command in your terminal (Git Bash):
    rm -rf .git

Configuration:

  • Environment Variables:
    • PORT: Port number the server listens on. Default: 3000
    • MONGODB_URI: URI for MongoDB database.
    • JWT_SECRET: Secret key for JWT token generation.
    • EXPIRES_IN: Token expiration time.

Usage:

  • API Endpoints:
    • POST /api/auth/login

      • Description: Authenticates user and returns a JWT token.
      • Request:
        { 
            "email": "[email protected]", 
            "password": "password" 
        }
      • Response:
        {
            "success": true, 
            "message": "User registered successfully"
        }
    • POST /api/auth/register

      • Description: Registers a new user.
      • Request:
        { 
            "name": "John", 
            "email": "[email protected]", 
            "password": "password" 
        }
      • Response:
        {
            "success": true,
            "message": "Login successful",
            "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InBoMkBleGFtcGxlLmNvbSIsImlhdCI6MTcwNzg1MDYyMSwiZXhwIjoxNzA3OTM3MDIxfQ.7EahSgmPLPNuZ_T9ok-B6TayWCJVdxPzi_Nx4UfrhvY"
        }

Dependencies:

  • bcrypt: Library for hashing passwords.
  • cors: Express middleware for enabling CORS.
  • dotenv: Loads environment variables from .env file.
  • express: Web framework for Node.js.
  • jsonwebtoken: Library for generating and verifying JWT tokens.
  • mongodb: MongoDB driver for Node.js.
  • nodemon: Utility for automatically restarting the server during development.

l2-b2-assignment-6-backend-Rimon0000

food-donation-and-supplies-management-backend-6's People

Contributors

rimon0000 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.