Skip to content

Amancodes26/note-management-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 

Repository files navigation

Note Management App

Note Management App Backend

This README provides documentation for the setup of the Note Management App. The backend is built using Node.js and Express.js, and it handles the creation, retrieval, updating, and deletion of notes.

Prerequisites

  • Node.js
  • MongoDB
  • npm (Node Package Manager)

Installation

  1. Clone the repository

    git clone https://github.com/DevanshChhabra/note-management-app.git
    cd note-management-app/backend
  2. Install dependencies

    npm install
  3. Set up environment variables

    Create a .env file in the backend directory with the following content:

    MONGO_URI=your_mongodb_connection_string
    JWT_SECRET=your_jwt_secret (for eg. afece612a7a8a0eff5a6192f68be52051c87ac3f70168ec998b8814eb2b077ab)
    
  4. Start the server

    npm start

API Endpoints

Authentication

  • Register a new user

    POST /api/auth/register
    • Body:
      {
        "name": "string",
        "email": "string",
        "password": "string"
      }
  • Login a user

    POST /api/auth/login
    • Body:
      {
        "email": "string",
        "password": "string"
      }

Notes

  • Create a new note

    POST /api/notes
    • Headers:

      x-auth-token: your_jwt_token
    • Body:

      {
        "color": "string",
        "content": "string",
        "title": "string",
        "date": "ISO 8601 date string"
      }
  • Get all notes for the logged-in user

    GET /api/notes
    • Headers:
      x-auth-token: your_jwt_token
  • Update a note

    PUT /api/notes/:id
    • Headers:

      x-auth-token: your_jwt_token
    • Body:

      {
        "color": "string",
        "content": "string",
        "title": "string",
        "date": "ISO 8601 date string"
      }
  • Delete a note

    DELETE /api/notes/:id
    • Headers:
      x-auth-token: your_jwt_token

Middleware

  • authMiddleware.js

    This middleware verifies the JWT token and adds the user information to the request object.

Controllers

  • authController.js

    Handles user registration and login.

  • noteController.js

    Handles CRUD operations for notes.

Models

  • User.js

    Defines the user schema and model.

  • Note.js

    Defines the note schema and model.

Configuration

  • db.js

    Handles the connection to the MongoDB database using Mongoose.

Note Management App Frontend

The frontend is build using react js and it's various libraries.

Local Setup

Frontend

  1. Navigate to the frontend folder:

    cd frontend
  2. Install all dependencies:

    npm install
  3. Run the React app:

    npm start

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •