-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
31 lines (24 loc) · 925 Bytes
/
app.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
import express from 'express';
import compression from 'compression';
import bodyParser from 'body-parser';
import indexRoute from './routes/index.js';
import nodeInfoRoute from './routes/node-info.js';
import postContextRoute from './routes/post-context.js';
const app = express();
app.use(compression());
app.use(express.static('public'));
app.use(bodyParser.urlencoded({
extended: true
}));
app.use(bodyParser.json());
app.use((req, res, next) => {
res.setHeader('Access-Control-Allow-Origin', '*');
// res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
// res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
// res.setHeader('Access-Control-Allow-Credentials', true);
next();
});
app.use('/', indexRoute)
app.use('/node-info', nodeInfoRoute)
app.use('/post-context', postContextRoute)
export default app;