-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
23 lines (17 loc) · 688 Bytes
/
Copy pathindex.js
File metadata and controls
23 lines (17 loc) · 688 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const express = require('express');
const app = express();
const bodyParser = require('body-parser');
const router = require('./config/router');
const { port, dbUri } = require('./config/environment');
// const errorHandler = require('./lib/errorHandler');
const mongoose = require('mongoose');
mongoose.Promise = require('bluebird');
mongoose.connect(dbUri);
app.use(express.static(`${__dirname}/public`));
app.use(bodyParser.json());
// app.use(errorHandler);
app.use('/api', router);
// Not in original
app.get('/*', (req, res) => res.sendFile(`${__dirname}/public/index.html`));
app.listen(port, () => console.log(`Express is listening on port ${port}`));
module.exports = app;