Sunday 20 January 2019

Could use a hand with a bit of code, POST method from form

I swear this was working last week, but now it aint. Any help appreciated. And I know it's a seemingly dumb question, but I know I'm missing something obvious. Must be the hangover.HTML:
JS.var express = require('express'); var bodyParser = require('body-parser'); var app = express(); app.use(bodyParser.urlencoded({ extended: true })); app.post('/', function(req, res) { var pName = req.body.name; res.send('You sent the name "' + pName + '".'); console.log(pName); }); app.listen(3000, function() { console.log('Server running at 3000'); });

Submitted January 20, 2019 at 05:53PM by 1foryes

No comments:

Post a Comment