Skip to content

avinashkholta/authentication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Authentication and User Management API

A Node.js backend API that provides user authentication with JWT and complete user CRUD operations.

Features

User Authentication (signup, login, logout)
JWT-based authentication with refresh tokens
Complete CRUD API for user management
Role-based access control (user/admin roles)
MongoDB integration
Tech Stack

Node.js
Express.js
MongoDB with Mongoose
JSON Web Tokens (JWT)
bcryptjs for password hashing
Prerequisites

Node.js (v14 or above)
MongoDB installed locally or MongoDB Atlas account
Installation

Clone the repository git clone cd auth-user-api

Install dependencies npm install

Set up environment variables Create a .env file in the root directory and add the following: PORT=3000 MONGODB_URI=mongodb://localhost:27017/auth_user_api JWT_SECRET=your_jwt_secret_key JWT_EXPIRE=1d

Start the server npm start

API Endpoints

Authentication Routes

POST /api/v1/auth/signup - Register a new user
POST /api/v1/auth/login - Login a user
GET /api/v1/auth/logout - Logout a user (requires authentication)
GET /api/v1/auth/me - Get logged in user info (requires authentication)
User Management Routes (Admin only)

GET /api/v1/users - Get all users
POST /api/v1/users - Create a new

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors