Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

125
Views
connect to server api page

ther by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). to terminate the node process on unhandled promise rejection, use the cli flag --unhandled-rejections=strict (see [

const router = require("express").Router();
const User = require("../modles/User");


router.get("/register", async (req,res) => {
   
    const user = await new User({
    username:"jhon",
       email:"jhon@gmail.com",
       password:"123456",
    
    
   })

   await user.save()
   res.send("ok")
   
});

module.exports = router;

]1 (rejection id: 1) (node:13400) [dep0018] deprecationwarning: unhandled promise rejections are deprecated. in the future, promise rejections that are not handled will terminate the node.js process with a non-zero exit code.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you only need a await and a catch. The first one is useless because you initialize your class.

So do that :

const router = require("express").Router();
const User = require("../modles/User");


router.get("/register", async (req,res) => {
   
    const user = new User({
    username:"jhon",
       email:"jhon@gmail.com",
       password:"123456",
   })

   await user.save().catch(e => e) // Return the errors in the void. You can console.log it.
   res.send("ok")
   
});

module.exports = router;
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!