-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
30 lines (26 loc) · 819 Bytes
/
index.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
const express = require('express');
const app = express();
const UsersSessionsController = require('./controllers/users.sessions.controller');
app.get('/parseUsersSessions', UsersSessionsController.getUsersSessions);
console.log('12');
app.use(express.static('public'));
/*error handler for log errors*/
app.use(function (err, req, res, next) {
console.log(err);
next(err);
});
/*global error handler middleware, must be last middlewae*/
//
app.use(function (err, req, res, next) {
/*if the headers are already sent to delegate the error to the default handler*/
if (res.headersSent) {
return next(err);
}
res.status(500);
res.json({ error: err });
}
);
app.listen(5002, () => {
console.log(`Server listener on 5002 port!
make request to localhost:5002 to see visualization of parsed file`);
})