-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathstart.js
More file actions
26 lines (22 loc) Β· 769 Bytes
/
start.js
File metadata and controls
26 lines (22 loc) Β· 769 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
const mongoose = require('mongoose');
// import environment variables
require('dotenv').config({ path: 'variables.env' });
// connect to the database
mongoose.connect(process.env.DATABASE);
mongoose.Promise = global.Promise;
mongoose.connection.on('error', err => {
console.log(`π
π« π
π« π
π« π
π« β ${err.message}`);
});
// require models
require('./models/User');
require('./models/Question');
require('./models/Quiz');
require('./models/CurrentQuiz');
require('./models/QuestionResponse');
require('./models/QuizHistory');
// start the app
const app = require('./app');
app.set('port', process.env.PORT || 5555);
const server = app.listen(app.get('port'), () => {
console.log(`Express running β‘ PORT ${server.address().port} `);
});