I’m trying to deploy https://baraholka-store-back.onrender.com to render. I’m getting 404 error when on all routes (no error in the logs).
It is a node typescript server. As a build comm i use ‘npm install && npm run build’, as start comm ‘npm run start’. THis is my package.json.
{
“name”: “server”,
“version”: “1.0.0”,
“description”: “”,
“main”: “./dist/index.js”,
“scripts”: {
“build”: “tsc”,
“start”: “tsc & node ./dist/index.js”,
“dev”: “tsc -w & nodemon .”
},
“keywords”: ,
“author”: “”,
“license”: “ISC”,
“dependencies”: {
“@types/multer”: “^1.4.7”,
“@types/streamifier”: “^0.1.0”,
“async-handler-express”: “^0.2.4”,
“cloudinary”: “^1.32.0”,
“cors”: “^2.8.5”,
“dotenv”: “^16.0.2”,
“express”: “^4.18.1”,
“express-csp-header”: “^5.1.0”,
“jsonwebtoken”: “^8.5.1”,
“mailgun-js”: “^0.22.0”,
“mongoose”: “^6.6.7”,
“morgan”: “^1.10.0”,
“multer”: “^1.4.5-lts.1”,
“streamifier”: “^0.1.1”
},
“devDependencies”: {
“@types/bcryptjs”: “^2.4.2”,
“@types/cors”: “^2.8.12”,
“@types/dotenv”: “^8.2.0”,
“@types/express”: “^4.17.14”,
“@types/jsonwebtoken”: “^8.5.9”,
“@types/mailgun-js”: “^0.22.12”,
“@types/morgan”: “^1.9.3”,
“@types/node”: “^18.7.18”,
“@types/nodemon”: “^1.19.2”,
“bcryptjs”: “^2.4.3”,
“nodemon”: “^2.0.20”,
“typescript”: “^4.8.4”
}
}
Solution:
- install typescript on project
- watch your api. ('deleted ‘/api/v1’)
- use as build commnad for ts ‘npm install && npm run build’
- do not put port in render.com env variables
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.