My server returns 404 when I try to submit a post request. I've stripped out nonessential logic. Nothing gets logged to the console. Somewhat at a loss here. Could the error be due to misconfiguration upstream of my server.js code? Also, a question that perhaps betrays some fundamental misunderstandings: Does it matter what url (or view) the client has accessed when pressing submit? Does the url have any bearing on the endpoint defined in the form / handled by server.js?
const express = require('express')
const connect = require('connect')
const serveStatic = require('serve-static')
const bodyParser = require('body-parser')
const app = express()
const port = 8080
app.use(bodyParser.urlencoded({extended: false}))
app.use((req, res, next) => {
console.log('A new request received at ' + Date.now());
next();
});
app.post('/', function(request, response){
console.log(request.body);
})
connect()
.use(serveStatic(__dirname))
.listen(port, () => console.log('Server running on 8080...'))
<form action="/" id="contact-form" method="post" role="form">