-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
59 lines (47 loc) · 1.48 KB
/
Copy pathindex.js
File metadata and controls
59 lines (47 loc) · 1.48 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// const path = require('path');
const express = require('express');
// const bodyParser = require('body-parser');
// const morgan = require('morgan');
const cors = require('cors');
const helmet = require('helmet');
// const compression = require('compression');
// const methodOverride = require('method-override');
// const Swagger = require('./swagger');
// const routes = require('./routes/index.route');
if (process.env.NODE_ENV !== 'production') {
require('dotenv-safe').config();
}
const app = express();
app.db = require('./models');
require('./jobs');
// teamwork.createNewTask({
// 'todo-item': {
// content: 'test content',
// 'responsible-party-id': '274572'
// }
// });
// const isProduction = process.env.NODE_ENV === 'production';
app.use(cors());
app.use(helmet());
// app.use(compression());
// app.use(bodyParser.json());
// app.use(morgan('dev'));
// app.use(express.static('dist'));
// app.use('/assets', express.static('assets'));
// app.get('/*', (req, res) => res.sendFile(path.join(__dirname, `../${isProduction ? 'dist' : 'client'}/index.html`)));
app.get('/', (req, res) => {
res.send('Hello world');
});
const port = process.env.APP_PORT || 3001;
const host = process.env.APP_HOST || 'localhost';
// app.db.sequelize
// .authenticate()
// .then(() => {
app.listen(port, () => {
console.log(`Server running at http://${host}:${port}`);
});
// })
// .catch(err => {
// console.error('Unable to connect to the database:', err);
// });
module.exports = app;