Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

201
Visualizações
Postman is not responding and hashedPassword is not generated

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

Terminal:screenshot enter image description here

Postman: in the body i am setting email and password as key value pair enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

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);
 });

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda