Skip to content

POST route not found at production server #5165

@wtaiatella

Description

@wtaiatella

In my project I'm using express 4.18.1 and for some reason there are some routes that are not working when I deploy the project at the production server. At local host all the routes work perfectly.

The project has the the /user route with these methods:
router.post('/login', async (req, res) => {...}
router.post('/register', async (req, res, next) => {...}
router.put('/recoverypassword', async (req, res) => {...}
router.put('/update', async (req, res) => {...}
router.put('/updatepassword', async (req, res) => {...}

It's weird because at localhost, ALL the routes work perfectly and at the production server the POST method doesn't work and I got the following answer when testing with Insomnia:

NotFoundError: Route not Found
    at eval (webpack://mercado-do-malte-api/./src/routes/user.ts?:142:10)
    at Generator.next (<anonymous>)
    at /var/www/mdm-api/node_modules/tslib/tslib.js:118:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/var/www/mdm-api/node_modules/tslib/tslib.js:114:16)
    at eval (webpack://mercado-do-malte-api/./src/routes/user.ts?:141:41)
    at Layer.handle [as handle_request] (/var/www/mdm-api/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/var/www/mdm-api/node_modules/express/lib/router/index.js:328:13)
    at /var/www/mdm-api/node_modules/express/lib/router/index.js:286:9
    at Function.process_params (/var/www/mdm-api/node_modules/express/lib/router/index.js:346:12)

My server is up and running at Linode and configures with Ubuntu and Nginx web server.
The API address is https://api.mercadodomalte.com.br/
This project is at my repo: https://github.com/wtaiatella/mercdomalte-backend

Can someone help me, why does the POST method only work at localhost?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions