I am simply trying to create a hashedpassword using bcryptjs and console.log that password so that I can copy and use it
i am using postman to test my POST request my plan is to send the request body as(email, password) using postman and i will read the body and pass the password to bcryptjs which will generate a hashedpassword and i want to console.log that out
now hashedpassword is not generated and also postman is not responding please help
index.js:
require('dotenv').config()
const exppess=require('express')
const cookieParser=require('cookie-parser')
const cors=require('cors')
const { verify }=require('jsonwebtoken')
const { hash, compare } = require('bcryptjs');
const bcrypt = require("bcrypt");
const { DB } = require('./DB');
const server=exppess()
server.use(cookieParser )
server.use(exppess.json )
server.use(exppess.urlencoded({ extended: true }))
server.post("/register",async (req,res)=>{
const { email, password } = req.body
try{
const hashedPassword = await hash(password, 10)
console.log(hashedPassword)
}
catch(err){
res.send({
error: `${err.message}`,
})
}
})
server.listen(process.env.PORT, () => {
console.log('server started on port: '+process.env.PORT);
});
.env file
ACCESS_TOKEN_SECRET=weibenrules
REFRESH_TOKEN_SECRET=weibenrulesevenmore
PORT=4000
Postman:
in the body i am setting email and password as key value pair

require('dotenv').config()
const exppess=require('express')
const cookieParser=require('cookie-parser')
const cors=require('cors')
const { verify }=require('jsonwebtoken')
const { hash, compare } = require('bcryptjs');
const bcrypt = require("bcrypt");
const { DB } = require('./DB');
const server=exppess()
server.use(cookieParser )
server.use(exppess.json )
server.use(exppess.urlencoded({ extended: true }))
server.post("/register",async (req,res)=>{
const { email, password } = req.body
try{
const hashedPassword = await hash(password, 10)
console.log(hashedPassword)
res.send(hashedPassword)
}
catch(err){
res.send({
error: `${err.message}`,
})
}
})
server.listen(process.env.PORT, () => {
console.log('server started on port: '+process.env.PORT);
});