Coder Social home page Coder Social logo

bezkoder / node-js-express-login-mongodb Goto Github PK

View Code? Open in Web Editor NEW
50.0 5.0 40.0 35 KB

Login and Registration example with Node.js Express and MongoDB using Mongoose, JWT, HTTP Cookies

JavaScript 100.00%
node nodejs node-js express expressjs express-js mongodb mongoose mongodb-database rest-api login authentication authorization

node-js-express-login-mongodb's Introduction

Node.js Express Login and Registration example with MongoDB and JWT

  • Appropriate Flow for User Login and Registration with JWT and Cookies
  • Node.js Express Architecture with CORS, Authentication & Authorization middlewares & Sequelize
  • How to configure Express routes to work with JWT
  • How to define Data Models and association for Authentication and Authorization
  • Way to use Sequelize to interact with MySQL Database

User Registration, User Login and Authorization process.

The diagram shows flow of how we implement User Registration, User Login and Authorization process.

node-js-express-login-example-mongodb-flow

For more detail, please visit:

Node.js Express Login and Registration example with MongoDB and JWT

Working with Front-end:

Angular 12 / Angular 13 / Angular 14 / Angular 15 / Angular 16 / Angular 17

React / React Redux

More Practice:

Node.js, Express & MongoDb: Build a CRUD Rest Api example

Server side Pagination in Node.js with MongoDB and Mongoose

Node.js Express File Upload Rest API example

Node.js + MongoDB: User Authentication & Authorization with JWT (using HTTP headers)

Associations:

MongoDB One-to-One relationship tutorial with Mongoose examples

MongoDB One-to-Many Relationship tutorial with Mongoose examples

MongoDB Many-to-Many Relationship with Mongoose examples

Fullstack:

Vue.js + Node.js + Express + MongoDB example

Angular 8 + Node.js + Express + MongoDB example

Angular 10 + Node.js + Express + MongoDB example

Angular 11 + Node.js + Express + MongoDB example

Angular 12 + Node.js + Express + MongoDB example

Angular 13 + Node.js + Express + MongoDB example

Angular 14 + Node.js + Express + MongoDB example

Angular 15 + Node.js + Express + MongoDB example

Angular 16 + Node.js + Express + MongoDB example

Angular 17 + Node.js + Express + MongoDB example

React + Node.js + Express + MongoDB example

Integration on same Server/Port:

Integrate Vue with Node.js Express

Integrate Angular with Node.js Express

Integrate React with Node.js Express

Project setup

npm install

Run

node server.js

node-js-express-login-mongodb's People

Contributors

tienbku avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

node-js-express-login-mongodb's Issues

while performing signup of the user, getting error C:\Users\acer\Desktop\product-poc\node_modules\bcryptjs\dist\bcrypt.js:189 throw Error("Illegal arguments: "+(typeof s)+', '+(typeof salt));

C:\Users\acer\Desktop\product-poc\node_modules\bcryptjs\dist\bcrypt.js:189
throw Error("Illegal arguments: "+(typeof s)+', '+(typeof salt));
^

Error: Illegal arguments: undefined, string
at Object.bcrypt.hashSync (C:\Users\acer\Desktop\product-poc\node_modules\bcryptjs\dist\bcrypt.js:189:19)
at exports.signup (C:\Users\acer\Desktop\product-poc\app\controllers\auth.controller.js:11:36)
at Layer.handle [as handle_request] (C:\Users\acer\Desktop\product-poc\node_modules\express\lib\router\layer.js:95:5)
at next (C:\Users\acer\Desktop\product-poc\node_modules\express\lib\router\route.js:144:13)
at checkRolesExisted (C:\Users\acer\Desktop\product-poc\app\middlewares\verifySignUp.js:51:3)
at Layer.handle [as handle_request] (C:\Users\acer\Desktop\product-poc\node_modules\express\lib\router\layer.js:95:5)
at next (C:\Users\acer\Desktop\product-poc\node_modules\express\lib\router\route.js:144:13)
at C:\Users\acer\Desktop\product-poc\app\middlewares\verifySignUp.js:34:7
at C:\Users\acer\Desktop\product-poc\node_modules\mongoose\lib\model.js:5074:18
at processTicksAndRejections (node:internal/process/task_queues:78:11)
[nodemon] app crashed - waiting for file changes before starting...
[nodemon] restarting due to changes...
[nodemon] starting node server.js
{ HOST: 'localhost', PORT: 27017, DB: 'bezkoder_db' }
Server is running on port 8089.
Successfully connect to MongoDB.
C:\Users\acer\Desktop\product-poc\node_modules\bcryptjs\dist\bcrypt.js:189
throw Error("Illegal arguments: "+(typeof s)+', '+(typeof salt));
^

Error: Illegal arguments: undefined, string
at Object.bcrypt.hashSync (C:\Users\acer\Desktop\product-poc\node_modules\bcryptjs\dist\bcrypt.js:189:19)
at exports.signup (C:\Users\acer\Desktop\product-poc\app\controllers\auth.controller.js:11:30)
at Layer.handle [as handle_request] (C:\Users\acer\Desktop\product-poc\node_modules\express\lib\router\layer.js:95:5)
at next (C:\Users\acer\Desktop\product-poc\node_modules\express\lib\router\route.js:144:13)
at checkRolesExisted (C:\Users\acer\Desktop\product-poc\app\middlewares\verifySignUp.js:51:3)
at Layer.handle [as handle_request] (C:\Users\acer\Desktop\product-poc\node_modules\express\lib\router\layer.js:95:5)
at next (C:\Users\acer\Desktop\product-poc\node_modules\express\lib\router\route.js:144:13)
at C:\Users\acer\Desktop\product-poc\app\middlewares\verifySignUp.js:34:7
at C:\Users\acer\Desktop\product-poc\node_modules\mongoose\lib\model.js:5074:18
at processTicksAndRejections (node:internal/process/task_queues:78:11)
[nodemon] app crashed - waiting for file changes before starting...

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.