How to Hash and Salt Passwords for Secure Database Storage with Node.js?
Install the bcrypt library:
npm install bcrypt
In your user registration route, hash the password using bcrypt:
const bcrypt = require('bcrypt');
// ...
// Hash password
const saltRounds = 10;
const salt = await bcrypt.genSalt(saltRounds);
...
harshmange.hashnode.dev2 min read