forked from parthbhatt268/api-rapidBasket
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
39 lines (28 loc) · 858 Bytes
/
index.js
File metadata and controls
39 lines (28 loc) · 858 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
34
35
36
37
38
39
const mongoose = require("mongoose")
const dotnev = require("dotenv");
const jwt = require('jsonwebtoken');
const app = require("./app")
dotnev.config({ path: "./.env" });
const stripe = require("stripe")(process.env.STRIPE_SECRET_KEY);
const DB = process.env.DATABASE.replace(
"<password>",
process.env.DATABASE_PASSWORD
);
mongoose
.connect(DB, { useNewUrlParser: true, useUnifiedTopology: true})
.then(() => console.log("DB connection successful!"))
.catch((err) => {
console.log(err);
});
const port = process.env.port;
const server = app.listen(port, () => {
console.log(`App running on port ${port}...`);
});
process.on("uncaughtException", (err) => {
console.log(err.name, err.message);
console.log("Uncaght Exception. Shutting Down....");
server.close(() => {
process.exit(1);
});
});
module.exports = stripe