Create an express connection
var exp = require (' xepress '),
HTTP = require (' http ');
Initializing the Exprerss module
var app = exp ();
Configure Port Numbers
App.set (' post ', 8080);
Set a static path
App.use (exp.static (__dirname + "folder path and name of the storage foreground data"));
Set icon
App.use (Exp.favicon ());
Error log output
App.use (Exp.logger ("dev"));
Allow overwrite
App.use (Exp.bodyparser ());
App.use (Exp.methodoverride ());
Output error Log
if (' Development ' ==app.get (' env ')) {
App.use (Exp.errorhandler);
}
Create a service
Http.createserver (APP). Listen (App.get (' post '), function () {
Console.log (' Express + post ' + app.get (' post '))
})
Form Connection
App.post (' connection properties ' of the form, function (req,res) {
var variable name = [req.body. Name,req.body of input under form. Name of input under form];
var variable name (con) = variable name of the background data path (obtained at the beginning of the declaration). The variable name of the exported function ([req.body. Name,req.body of input under form. Name],function of input under form (E,R,F) {
if (!e) {
if (r.length) {
redirect
Res.redirect (' HTML ' of the Web page that needs to be opened);
}
}
})
})
Nodejs Form Validation