Routing 404 error on my app


I’m trying to deploy my application onto Netlify, this is the domain

I have it connected to CI/CD on Git. I also have a netlify.toml file set up for the env variables, and headers for cors since my front and backend are in the same deploy.

command = “npm run build”
publish = “build”

for = “/"
Access-Control-Allow-Origin = "

Access-Control-Allow-Methods = “GET, POST, PUT, DELETE, OPTIONS”
Access-Control-Allow-Headers = “Authorization, Content-Type, x-ms-request-root, x-ms-request-body, x-ms-request-id”

Environment variables

DB_HOST = “##”
DB_USER = “##”
DB_PORT = “##”

I also have the publish directory to “build” which is located in my root dir of my React app.

However with all of these checked, im still getting a Night-In error and i cannot figure out why.

If anyone can help me out i will appreciate it.

Hi @ish , thanks for the post.
Do you get the 404 when you navigate to a specific page, when you try to login, or when you refresh your page after visiting?


Hi clarnx,

Thanks for getting back to me.

At the landing page is a simple login button where my client side function on the login button sends an axios post request to my backend folder where it holds the code to get the information from my database.

On this axios route i have it set to where my backend server recieves it at“/”, handleLogin);

Locally this works fine if i have my client side route to http://localhost:3001.

This is the error message below:

POST 404 (Not Found)


Hi @ish , thanks for the feedback.

The above does not because your api route is not correct.
Kindly take a look at the forum link below to see how to properly deploy Express applications to Netlify.

Also take note of the below. It has been quoted from Netlify’s Functions Documentation at Get started with functions | Netlify Docs

These formats would deploy a synchronous function that can be called on the following endpoint: /.netlify/functions/hello . The endpoint is relative to the base URL of your site. Here are some example full endpoint URLs: for a site using the default Netlify subdomain or for a site using a custom domain