本文整理汇总了TypeScript中express.bodyParser函数的典型用法代码示例。如果您正苦于以下问题:TypeScript bodyParser函数的具体用法?TypeScript bodyParser怎么用?TypeScript bodyParser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bodyParser函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
app.configure(function () {
app.set('view engine', 'ejs');
app.engine('.html', engine.renderFile);
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.static('public'));
});
示例2:
app.configure(function () {
console.log("app.configure");
app.use(express.bodyParser());
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.use(express.static(__dirname + '/public'));
});
示例3: intializeWebServer
private intializeWebServer() {
this.app = express();
this.app.use(express.bodyParser());
this.app.use('/', express.static(__dirname + '/content'));
this.app.post('/api/signup', this.signup.bind(this));
this.app.get('/api/:username/:queue', this.getMessages);
this.app.post('/api/:username/:queue', this.sendMessage);
}
示例4:
app.configure(function () {
app.use(express.static('public'));
app.use(express.cookieParser());
app.use(express.bodyParser());
app.use(express.session({ secret: 'keyboard cat' }));
app.use(passport.initialize());
app.use(passport.session());
app.use(app.router);
});
示例5:
app.configure(function () {
app.use(express.favicon());
app.use(express.logger());
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(path.join(application_root, "public")));
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
示例6:
app.configure(()=>{
app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));
});
示例7:
app.configure(function () {
app.use(express.bodyParser());
app.use(express.static(__dirname + '/public'));
app.get('/api/todo', routes.getallTodoes);
app.get('/api/todo/MetaData', routes.getMetadata);
app.get('/api/todo/:todoid', routes.getTodoById);
app.post('/api/todo', routes.saveChanges);
app.get('/api/faketodo', routes.getallFakeTodoes);
app.get('/api/faketodo/MetaData', routes.getFakeMetaData);
app.get('/api/faketodo/:todoid', routes.getFakeTodoById);
app.post('/api/faketodo', routes.saveFakeChanges);
});
示例8: express
pause: pause,
setupZlapser: setupZlapser,
snap: snap,
shutdown: shutdown,
setScript: setScript
}
})();
var app = express();
var theServer = http.createServer(app);
var io = require('socket.io').listen(theServer);
app.use(express.bodyParser());
app.post("/data", model.setupZlapser);
app.post("/start", model.start);
app.post("/stop", model.stop);
app.post("/pause", model.pause);
app.post("/resume", model.pause);
app.post("/snap", model.snap);
app.put("/shutdown", model.shutdown);
app.get("/readme.md", (req, res)=> {
fs.readFile(__dirname + '/readme.md', 'utf-8', function (err, data) {
if (err) {
res.send("<p>Error getting readme.md</p>");
}
var converter = new pagedown.Converter();
res.send(")]}',\n" + converter.makeHtml(data));
示例9: done
done(null, results);
}
},replace);
}
else {
if (!--pending) {
done(null, results);
}
}
});
});
});
};
server.use(express.bodyParser());
server.use(express.cookieParser());
server.use(express.compress());
server.get('/', function (req, res) {
res.render(path.resolve(__dirname, '../app.html'));
});
var cachedFiles:any[] = null;
/**
* A Quick demo hack for enumerating system files. Calculate this once and cache it, because
* it could potentially be an expensive operation, and we'll be running on slow ass free Heroku
* servers.
*/
server.get('/files', function (req, res) {
if(cachedFiles){
res.json(cachedFiles,200);
示例10: require
// .These two lines are required to initialize Express in Cloud Code.
var express = require('express');
var app = express();
// .Global app configuration section
app.set('views', 'cloud/views'); // .Specify the folder to find templates
app.set('view engine', 'ejs'); // .Set the template engine
app.use(express.bodyParser()); // .Middleware for reading request body
// .This is an example of hooking up a request handler with a specific request
// path and HTTP verb using the Express routing API.
app.get('/hello', function(req: any, res: any) {
res.render('hello', { message: 'Congrats, you just set up your app!' });
});
// // Example reading from the request query string of an HTTP get request.
// app.get('/test', function(req, res) {
// // GET http://example.parseapp.com/test?message=hello
// res.send(req.query.message);
// });
// // Example reading from the request body of an HTTP post request.
// app.post('/test', function(req, res) {
// // POST http://example.parseapp.com/test (with request body "message=hello")
// res.send(req.body.message);
// });
app.get('/post/:objectId', function(req: any, res: any) {