Backend deployment


I am trying to deploy backend and each time I get Cannot GET in the browser.

This is the package.json:
“name”: “ecommerceserver”,
“version”: “1.0.0”,
“description”: “”,
“main”: “index.js”,
“type”: “module”,
“scripts”: {
“test”: “echo "Error: no test specified" && exit 1”,
“start”: “node index.js”,
“dev”: “nodemon index.js”
“keywords”: ,
“author”: “”,
“license”: “ISC”,
“devDependencies”: {
“nodemon”: “^3.0.1”
“dependencies”: {
“bcrypt”: “^5.1.1”,
“cors”: “^2.8.5”,
“dotenv”: “^16.3.1”,
“express”: “^4.18.2”,
“jsonwebtoken”: “^9.0.2”,
“mongoose”: “^8.0.0”

this is the index.js:
import express from “express”
import “dotenv/config”
import client from “./db/db.js”
import cors from “cors”
import usersRouter from “./routes/user.js”
import productsRouter from “./routes/product.js”
import ordersRouter from “./routes/order.js”
import cartRouter from “./routes/cart.js”
import authRouter from “./routes/auth.js”

const app = express()

app.use(express.urlencoded({extended: true}));

origin: “http://localhost:5173”,

methods: ["GET", "POST", "PUT", "DELETE"],
allowedHeaders: ["Content-Type", "Authorization", "Access-Control-Allow-Origin", "Access-Control-Allow-Credentials"],
credentials: true,


app.use(“/api/users”, usersRouter)
app.use(“/api/products”, productsRouter);
app.use(“/api/orders”, ordersRouter);
app.use(“/api/cart”, cartRouter);
app.use(“/api/auth”, authRouter)

const port = 3000 || process.env.PORT

client.on(“connected”, () => {
app.listen(port, () => {
console.log(Server listening on port ${port})
app.listen(80, function () {
console.log(‘CORS-enabled web server listening on port 80’)

I have imported all my environment variables.
Build & deploy settings are:
root directory: empy
build command: npm install
start command: npm run dev
-deployment as web services since it’s backend

I have tried changing the start command into node index.js and when deployed, still same error.

Any idea on what am I missing out?

Thank you!

Hi Sanja i noticed you havnt gotten any reply, sorry for that.

have you gotten solution for this already ?

If no, let me know

NOTE: anything you get can not with a particular METHOD, something like this Cannot GET it means there is no route with such method… and the rest of others

Thank you!


There’s simply no root path set on your server so any query to is 404’ing.

Render Support, UTC+3

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.