Axios POST Request works on localhost but no longer works after deploying on Netlify

Hi there! I have an error while axios post request after deploying on Netlify. The error is:

Failed to load resource: the server responded with a status of 404 ()
createError.js:17 Uncaught (in promise) Error: Request failed with status code 404
at e.exports (createError.js:17)
at e.exports (settle.js:19)
at XMLHttpRequest.d.onreadystatechange (xhr.js:60)


        method: 'POST',
        data: {
          name: name,
          email: email,
          messsage: message
.then( ( res ) => {
        if ( === 'success' ) {
          this.setState( {display: 'none'} );
          this.setState( { showModalSuccess: true } );
        } else if ( === 'fail' ) {
          this.setState( {display: 'none'} );
          this.setState( { showModalError: true } );


const express = require ('express');
const nodemailer = require('nodemailer');
const bodyParser = require("body-parser");
const path = require('path');
const cors = require('cors')
const config = require('./config.js');
const app = express();


    extended: false

app.use( bodyParser.json() );'/send', (req, res) => {
const output = `
   <p>You have a new contact request</p>
   <h3>Contact Details</h3>
     <li>Name: ${}</li>
     <li>Email: ${}</li>

// Create reusable transporter object using the default SMTP transport
   let transporter = nodemailer.createTransport({
    host: '',
    port: 587,
    secure: false, // true for 465, false for other ports
    service: "ethereal",
    auth: {
      user: '',
      pass: 'pass.pass'
  transporter.verify((error, success) => {
    error ? console.log( error ) : console.log( 'Server is ready to take message' )

// setup email data with unicode symbols
  let mailOptions = {
   from: `${}`,
   to: '',
   subject: 'A new request frow web page', // Subject line
   // text: '', // Plain text body
   html: output // HTML body

// Send mail with defined transport object
  transporter.sendMail(mailOptions, (error, data) => {
    if (error) {
        msg: 'fail'
    } else {
        msg: 'success'
      console.log('Message sent: %s', data.messageId);
      console.log('Preview URL: %s', nodemailer.getTestMessageUrl(data));

app.listen( config.server.port, () => {
  console.log( `Server running on port ${ config.server.port }` );
} );

Can smbd help?

Hi, @xlakostax. Where is the server running?

It is a Netlify Function or is it deployed to another service (such as Heroku or AWS Lambda)?

Hi @Luke! What do u mean “Netlify Function”? I apologize, I am not experienced in Netlify so far. I just create a relationship between my Netlify acc and my Git. The server is a part of a project. And I have to mention I use React Router for navigation. It seems the problem is due to it.

Ah, ok, thank you for that explanation. Servers won’t run on Netlify, please check out this post to learn more: [Common Issue] Can I run a web server, HTTP listener, and/or database at Netlify?

Hope that helps!