-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.js
More file actions
33 lines (29 loc) · 857 Bytes
/
server.js
File metadata and controls
33 lines (29 loc) · 857 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
27
28
29
30
31
32
33
const dotenv = require('dotenv');
const admin = require('firebase-admin');
admin.initializeApp({
credential: admin.credential.cert(
require('../SW_GP/utils/serviceAccountKey.json'),
),
});
const firestore = admin.firestore();
firestore.settings({
ignoreUndefinedProperties: true,
});
process.on('uncaughtException', (err) => {
console.log('UNCAUGHT EXCEPTION! Shutting down...');
console.log(err.name, err.message);
process.exit(1);
});
dotenv.config({ path: './.env' });
const app = require('./app');
const port = process.env.PORT || 3000;
const server = app.listen(port, '0.0.0.0', () => {
console.log(`App running on port ${port}...`);
});
process.on('unhandledRejection', (err) => {
console.log('UNHANDLED REJECTION! Shutting down...');
console.log(err.name, err.message);
server.close(() => {
process.exit(1);
});
});