saving port to a variable

This commit is contained in:
Miodec 2021-06-16 00:47:34 +01:00
parent 8cb954dd88
commit 7d4759017c

View file

@ -9,6 +9,8 @@ const admin = require("firebase-admin");
const serviceAccount = require("./credentials/serviceAccountKey.json");
const { connectDB } = require("./init/mongodb");
const PORT = process.env.PORT || 5005;
// MIDDLEWARE & SETUP
const app = express();
app.use(express.urlencoded({ extended: true }));
@ -23,8 +25,8 @@ app.use(function (e, req, res, next) {
return res.status(e.status || 500).json(e || {});
});
app.listen(process.env.PORT || 5005, async () => {
console.log(`listening on port ${process.env.PORT}`);
app.listen(PORT, async () => {
console.log(`listening on port ${PORT}`);
await connectDB();
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),