Linking Html Form Action To Node Js Function
I'm trying to execute a function in node.js when a users enters information on a form in html. I keep getting 404 not found and am not sure where to go. I'm sure there are other qu
Solution 1:
The order of middleware loading is important: middleware functions that are loaded first are also executed first.
You added the /zipCheck
route after the error handler, your requests will never reach this handler and
your app will not print GOOD
.
You need to reorder your routes handler, also add a slash before zipCheck
app.use('/', indexRouter);
app.use('/users', usersRouter);
app.post('/zipCheck', function(req, res){
console.log("GOOD");
});
// error handler
app.use(function(err, req, res, next) {
})
Post a Comment for "Linking Html Form Action To Node Js Function"