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

216
Views
My code is working perfectly on localhost but I'm getting Cannot GET/ error message while deploying on Heroku Server

My code is working perfectly on localhost but I'm getting Cannot GET/ error message while deploying on Heroku Server.

my index.js code

const express = require('express')
const app = express()
const dotenv = require('dotenv').config()
const bodyParser = require('body-parser')

const port = process.env.PORT || 3000

app.use(express.json())

app.use(bodyParser.urlencoded({extended:true}))
app.use(bodyParser.json())

const {dbConnection} = require('./connection/database')
dbConnection()

const routes = require('./route/routes')
app.use('./route', routes)

app.listen(process.env.PORT || 3000, ()=>{
    console.log(`code is running on ${port}`)
})

my connection code

const mongoose = require('mongoose')

const dbConnection = async()=>{
    try{
        console.log('MongoDB Connected', process.env.DB_CONNECT)
        var mongoURI = "mongodb://mongo:27017/index.js"
        const conn = await mongoose.connect("mongodb://127.0.0.1:27017/welcome",{
            useNewUrlParser: true,
            useUnifiedTopology: true
        }).then((conn)=>{
            console.log(`mongoDB Connected : ${conn.connection.host}`)
        })
    }catch (error){
        console.log('error while connectingdb' + error)
    }
}

module.exports={dbConnection}
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!