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

178
Views
createError.js:16 Uncaught (in promise) Error. reactJS to mongodb connection

I'm trying to connect React website to MongoDB, When I submit the username, email and password this message appears to me. although the first attempt success.

Error Message

xhr.js:187 POST http://localhost:8080/register 500 (Internal Server Error)
createError.js:16 Uncaught (in promise) Error: Request failed with status code 500

db.js

const dotenv = require("dotenv")
dotenv.config()
const mongodb = require("mongodb")

mongodb.connect(process.env.CONNECTIONSTRING, { useNewUrlParser: true, useUnifiedTopology: true }, function(err, client) {
  if (err) {
    console.log(err)
  }
  module.exports = client
  const app = require("./app")
  app.listen(process.env.PORT)
})

.env

CONNECTIONSTRING=mongodb+srv://username
PORT=8080
JWTSECRET=password

Can anyone help me with this, thank you In advance!

about 4 years ago · Juan Pablo Isaza
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!