Skip to content

Latest commit

Β 

History

History
126 lines (90 loc) Β· 2.46 KB

File metadata and controls

126 lines (90 loc) Β· 2.46 KB

πŸš€ iNoteBook Backend

A secure and scalable REST API for the iNoteBook application. This backend provides user authentication, note management, and MongoDB database integration using Node.js and Express.js.

✨ Features

  • πŸ” User Authentication (JWT)
  • πŸ‘€ User Registration & Login
  • πŸ“ Create Notes
  • πŸ“– Read Notes
  • ✏️ Update Notes
  • πŸ—‘οΈ Delete Notes
  • πŸ›‘οΈ Protected Routes
  • 🌐 RESTful API Architecture
  • πŸ“¦ MongoDB Database Integration

πŸ› οΈ Tech Stack

  • Node.js
  • Express.js
  • MongoDB
  • Mongoose
  • JWT Authentication
  • bcrypt.js
  • dotenv

πŸ“‚ Project Structure

backend/
β”œβ”€β”€ bin/
β”œβ”€β”€ middleware/
β”œβ”€β”€ models/
β”œβ”€β”€ routes/
β”œβ”€β”€ db.js
β”œβ”€β”€ app.js
β”œβ”€β”€ package.json
└── .env

βš™οΈ Installation

1. Clone the Repository

git clone https://github.com/CodeWithMSami/iNoteBook-Backend.git
cd iNoteBook-Backend

2. Install Dependencies

npm install

3. Configure Environment Variables

Create a .env file in the root directory:

MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
PORT=3000

4. Start the Server

Development:

npm run dev

Production:

npm start

πŸ”— API Endpoints

Authentication

Method Endpoint Description
POST /api/auth/createuser Register a new user
POST /api/auth/login Login user
POST /api/auth/getuser Get authenticated user

Notes

Method Endpoint Description
GET /api/notes/fetchallnotes Fetch all notes
POST /api/notes/addnote Create note
PUT /api/notes/updatenote/:id Update note
DELETE /api/notes/deletenote/:id Delete note

πŸ”’ Authentication

Protected routes require a valid JWT token in the request header:

auth-token: YOUR_JWT_TOKEN

πŸš€ Future Improvements

  • Email Verification
  • Password Reset
  • Note Categories
  • File Attachments
  • Rate Limiting
  • API Documentation

🀝 Contributing

Contributions are welcome. Feel free to fork the repository, create a feature branch, and submit a pull request.

πŸ“„ License

This project is licensed under the MIT License.


Developed with ❀️ by CodeWithMSami