-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
32 lines (24 loc) · 918 Bytes
/
app.js
File metadata and controls
32 lines (24 loc) · 918 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
const express = require('express');
const path = require('path');
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
const xmlParser = require('express-xml-bodyparser');
// const db = require('./config/mongoConnection');
const index = require('./routes/index');
const graphRoute = require('./routes/graphDatabase');
const app = express();
const port = process.env.PORT || '3030';
app.set('views', path.join(__dirname, 'views'));
app.use(bodyParser.json());
app.use(xmlParser());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', index);
app.use('/api/graph/', graphRoute);
app.use((req, res) => {
res.status(404).send({ url: `${req.originalUrl} not found` });
});
const server = app.listen(port, () => {});
console.log(`Connected on port ${port}`);
module.exports = app;