Sunday 20 January 2019

Need help with express/HTML routing, completely stuck

I've been at this for hours, and cannot for the life of me figure out what I'm missing. No doubt it's a simple thing, but I cant seem to see it. I open my html page, and... nothing happens when i click the submit button. Again, it's a dumb question, but I'm stumped.I've checked as many stackexchange solutions as I can find, as well as several other sites. Nothing works, or so it seems.HTML (cant get simpler than this)
JSvar express = require("express"); var bodyParser = require("body-parser"); var app = express(); app.use(bodyParser.urlencoded({extended: true})); app.post('/', function(req, res){ res.send("you sent " + req.body.name); console.log(req.body.name); }); app.listen(3000);

Submitted January 20, 2019 at 09:02PM by 1foryes

No comments:

Post a Comment