-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
34 lines (27 loc) · 1.09 KB
/
server.js
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
34
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
app.set('view engine', 'ejs'); // set up ejs for templating
app.use("/save/*", bodyParser.json());
app.post("/save/step1", require("./server/step1saveHandler"));
// respond with "hello world" when a GET request is made to the homepage
app.use(express.static('.'));
/** folowing block records errors with descriptors **/
app.use("/wizard/errorReport", bodyParser.urlencoded({
extended: false
}));
app.post("/wizard/errorReport", (req, res)=>{
var body = req.body;
console.log("Error parsing wizard or wizard step: ", body.obtainedDescriptor);
console.log("Url: ", body.url);
console.log("requestData: ", body.requestData);
console.log("Method: ", body.method);
console.log("Error stack: ", body.stackTrace);
res.end("accepted");
});
/** END folowing block records errors with descriptors **/
var server = app.listen(8000, function () {
var host = server.address().address;
var port = server.address().port;
console.log('Example app listening at http://%s:%s', host, port);
});