My node js application deployed successfully but not running well,it is giving error 'default backend - 404'

Issue : Application not running well.
OS: win 10,
Database : Mongo
Language : NodeJS

I am deploying first time on qovery, ‘qovery run’ command run successfully at local. Also deployed successfully on qovery server. But running well giving error ‘default backend - 404’

Dockerfile content (if any)

My Dockerfile are given below

FROM node:14
RUN mkdir -p /src/user/app
WORKDIR /src/user/app
COPY package*json ./
COPY . .
RUN npm install
EXPOSE 3000
CMD [“node”,“server.js”]

And my .qovery.yml file here


application:
name: “shopper-api-git-hub”
project: “shopper”
organization: “QoveryCommunity”

databases:

  • type: “MONGODB”
    name: “shopper”
    version: “4.4”

routers:

  • name: “main-shopper-api-git-hub”
    routes:
    • application_name: “shopper-api-git-hub”
      paths:
      • “/*”

Hello,
did you setup an endpoint at root url ("/") ? If yes what is it supposed to do ? Get ? Post ?

Here is me server.js file

const http = require(‘http’);

const hostname = ‘0.0.0.0’;

const port = 3333;

const MY_MESSAGE = process.env.MY_MESSAGE

const server = http.createServer((req, res) => {

res.statusCode = 200;

res.setHeader(‘Content-Type’, ‘text/plain’);

res.end(MY_MESSAGE);

});

server.listen(port, hostname, () => {

console.log(Server running at http://${hostname}:${port}/);

});

As far as I can see, you’re using port 3000 in dockerfile and port 3333 in server.js. Could you please set the same. It could be the reason of the issue.

Corrected the port both side, but no benefit

The code used seems outdated. Application log prints “Hello Terminal” instead of “Server running at http://${hostname}:${port}/”.

Could you please use qovery deploy <commit_id> with your last commit to update your Qovery environment.

Thanks bro, It is working fine now.

1 Like