-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathtst.js
More file actions
33 lines (24 loc) · 944 Bytes
/
tst.js
File metadata and controls
33 lines (24 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var app = require('express')();
app.set('view engine', 'hbs');
app.use(require('body-parser').json());
app.use(require('body-parser').urlencoded({ extended: false }));
app.post('/path', function(req, res) {
var bodyParameter = req.body.bodyParameter; // $ Source
var queryParameter = req.query.queryParameter; // $ Source
res.render('template', bodyParameter); // $ Alert
res.render('template', queryParameter); // $ Alert
if (typeof bodyParameter === "string") {
res.render('template', bodyParameter);
}
res.render('template', queryParameter + "");
res.render('template', {profile: bodyParameter});
indirect(res, queryParameter);
});
function indirect(res, obj) {
res.render("template", obj); // $ Alert
const str = obj + "";
res.render("template", str);
res.render("template", JSON.parse(str)); // $ Alert
}
let routes = require('./routes');
app.post('/foo', routes.foo);