'how to solve an listining error in javascript & json

//importing pckg

const express = require('express');
const admin = require('firebase-admin');
const bcrypt = require('bcrypt');
const path = require('path');

//inisialisation express.js
const app = express();

//routes

//home route
app.get("/", (req, res) => {
  res.sendFile(path.join(__dirname, "public", "index.html"));
})

app.listen(5500, () => {
  console.log('listning on port 5500................');
})

I have problem in my server.js. I am working on ecommerce website database with firebase & json & javascript and i have a error. It doesn't do listen at all and this the result.



Solution 1:[1]

It seems that the app.get("/"), you are sending HTML content in browser, make sure the path of public/index.html available.

To test the server, just add below code & check it.

res.send(" hello there");

in app.get("/")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Suresh Koochana