Code Monkey home page Code Monkey logo

saiyamdubey / beaman_app Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 0.0 291 KB

In this app i learned JWT_Authentication , Frontend , Server Side rendering , MVC File Pattern and more , this will show you how to work with the authurization of the permissions and Authentication , token creation in production App .

Home Page: https://be-a-man-app.vercel.app

JavaScript 16.94% HTML 83.06%
es5 expressjs front-end-development html-css-javascript mongodb moongose nodejs nodejs-server routing server-side-rendering ssr

beaman_app's Introduction

BeAMan_Application

In this app i learned JWT_Authentication , Frontend , Server Side rendering , MVC File Pattern and more , this will show you how to work with the authurization of the permissions and Authentication , token creation in production App .

Overview

This repository contains a sample implementation of JSON Web Token (JWT) authentication. JWT is a compact, URL-safe means of representing claims to be transferred between two parties. It is commonly used for authentication and authorization purposes in web applications.

Features

  • User Registration: Register new users with unique credentials.
  • User Login: Authenticate users and generate JWT tokens for subsequent requests.
  • Token Refresh: Allow users to refresh their JWT tokens to extend their session.
  • Middleware: Implement middleware to protect routes that require authentication.

Technologies Used

  • Node.js: JavaScript runtime for server-side development.
  • Express.js: Web application framework for Node.js.
  • jsonwebtoken: Library for generating and verifying JSON Web Tokens.
  • MongoDB: NoSQL database for storing user information.
  • dotenv: Module to load environment variables from a .env file.

Setup

  1. Clone the repository:
git clone https://github.com/your-username/BeAMan_App.git
cd JWT_authentication
Install dependencies:
Copy code
npm install

Create a .env file in the project root and configure environment variables:

env

Copy code PORT=8000 // give your port here MONGODB_URI=mongodb://localhost:27017/userlist JWT_SECRET=your-secret-key // BeAMan Start the server:

bash

Copy code

npm start dev

The server should now be running at http://localhost:8000.

API Endpoints

POST /api/register: Register a new user. POST /api/login: Log in and receive a JWT token. POST /api/refresh-token: Refresh the JWT token. GET /api/protected-route: Example protected route requiring authentication. Usage Register a new user using the /api/register endpoint. Log in with the registered credentials using the /api/login endpoint to receive a JWT token. Use the token to access protected routes like /api/protected-route. To extend the session, use the /api/refresh-token endpoint with the refresh token. Contributors Your Name [email protected] License This project is licensed under the ISC License.

created By --- Saiyam_Dubey,

beaman_app's People

Contributors

saiyamdubey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  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.