Cannot POST form nodejs

343
September 13, 2017, at 7:20 PM

Here is my form.html

<form action="/submit" method="post" enctype="multipart/form-data">
Email<br>
<input type="email" tabindex="-1" class="email-field" name="email" placeholder="Your email address..."><br><input class="btn btn-primary btn-xl js-scroll-trigger"type="submit" value="Submit">
</form>

and here is app.js

 var http = require('http');
var express = require('express');
var fs = require('fs');
app = express.createServer();
app.configure(function(){
  app.set('port', process.env.PORT || 3000);
  app.use(express.logger('dev'));
  app.use(express.bodyParser());
});
app.post('/submit', function(req, res) {
  fs.appendFile('emailDatabase.txt', req.body.email, function (err) {
        if (err) throw err;
      console.log('Saved!');
    });
});

And I'm getting error Cannot POST /submit I've only 1 form I want to process and app.js is all my "backend".Those 2 files are in the same dir It all seems to be fine or should I define routes ?? Basically it is just landing page to create email database

Rent Charter Buses Company
READ ALSO
Using websockets for push notifications

Using websockets for push notifications

I'm building a desktop background service that should be cross platformI'm going to write this service as a node

628
puppeteer - how to submit form

puppeteer - how to submit form

How do I submit the form? I have a simple search bar and a search buttonThe following enters the search string, but the click event is not fired

687