Skip to content

Latest commit

Β 

History

History
70 lines (46 loc) Β· 1.92 KB

File metadata and controls

70 lines (46 loc) Β· 1.92 KB

πŸ›‘οΈ Authentication Backend API

This is a Node.js and Express.js backend project providing user authentication and CRUD (Create, Read, Update, Delete) functionality for posts. It uses MongoDB via Mongoose, JWT for secure user sessions, and follows a clean MVC architecture. Ideal for building a secure backend for web or mobile applications.


πŸ“Œ Table of Contents

  • Features(#-features)
  • Tech Stack(#-tech-stack)
  • Setup Instructions(#-setup-instructions)
  • Environment Variables(#-environment-variables)
  • API Endpoints(#-api-endpoints)
  • Auth Routes(#auth-routes)
  • Post Routes(#post-routes)

πŸš€ Features

βœ… User Registration & Login πŸ”’ Password hashing with bcrypt πŸ” Token-based authentication using JWT πŸ”„ CRUD operations for posts 🧱 Follows MVC architecture 🌐 RESTful API design πŸ“¦ .env support for environment configs πŸ›‘οΈ Protected routes for authenticated users only

πŸ› οΈ Tech Stack

  • Node.js
  • Express.js
  • MongoDB + Mongoose
  • JWT for authentication
  • bcrypt for password hashing
  • dotenv for environment variables
  • Postman (for testing)

βš™οΈ Setup Instructions

  1. Clone the repository

bash git clone https://github.com/Nboss21/authentication_backend.git cd authentication_backend

πŸ”‘ Auth Routes (/auth)

Method Endpoint Description
POST /register Register a new user
POST /login Authenticate a user and return JWT

πŸ“ Post Routes (/posts)

Method Endpoint Description
GET /all-post Get all posts
GET /post/:id Get a single post by ID
POST /create Create a new post
PUT /update/:id Update a post by ID
DELETE /delete/:id Delete a post by ID