forked from clembou/github-requests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
27 lines (20 loc) · 921 Bytes
/
server.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
'use strict';
const express = require('express');
const path = require('path');
const fs = require('fs');
// This doesn't work if moved in to a separate file, I don't know why
// set up environment variables from a `client\.env` if it exists (useful when developing)
const envPath = path.resolve(__dirname, 'client', '.env');
if (fs.existsSync(envPath)) {
require('dotenv').config({ path: envPath });
}
const app = require('./backend/app/app');
require('./backend/app/cors');
// this needs to be added early so that headers are added to all subsequent responses
require('./backend/app/headers');
// I think this has to be added before the routes, so that the routes get logged, but I'm not sure
require('./backend/app/logging');
require('./backend/authenticatedRoutes/authenticatedRoutes');
require('./backend/dangerousOpenRoutes/dangerousOpenRoutes');
// this has to happen last
require('./backend/app/listen');