title: Nuxt - server middleware not working on production
body: <p>I have builded an app using Nuxt and I have created simply server middleware for handling email sending. Everything is working on dev but on production I have 404 error from that endpoint. Does anybody know how to include server-middleware into build files or any other way?</p>
  <p>server-middleware:</p>
  <pre><code>const bodyParser = require('body-parser')
  const app = require('express')()
  
  app.use(bodyParser.json())
  
  app.post('/', (req, res) =&gt; {
  // Some code here
  })
  
  module.exports = app
  </code></pre>
  <p>Nuxt.config.js</p>
  <pre><code>serverMiddleware: [
      { path: '/contact/send', handler: '~/server-middleware/email.js' }
    ],
  </code></pre>
  <p>Response here:
  <a href="https://i.stack.imgur.com/fPkOR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fPkOR.png" alt="enter image description here" /></a></p>