-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
32 lines (25 loc) · 807 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
32
const express = require('express');
const logger = require('morgan');
const path = require('path');
const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser');
const app = express();
const server = require('http').Server(app);
require('dotenv').config();
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static('public'));
const port = process.env.PORT || 3001;
server.listen(port, () => {
console.log(`Pumping on ${port}`);
});
app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'index.html'));
});
const mtaRoutes = require('./routes/mta-routes');
app.use('/mta', mtaRoutes);
app.get('*', (req, res) => {
res.status(404).send('not found!');
})