Created
June 15, 2020 13:38
-
-
Save NALAWALAMURTUZA/8863c4964c584b5a4d3beb19f2fa5d55 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as mongoose from 'mongoose'; | |
import express from "express"; | |
import job from './jobs/job'; | |
export const app = express(); | |
mongoose | |
.connect('mongodb://localhost:27017/demo', { | |
useNewUrlParser: true, | |
useUnifiedTopology: true, | |
useCreateIndex: true, | |
serverSelectionTimeoutMS: 5000 // Timeout after 5s instead of 30s | |
}) | |
.then(async connection => { | |
app.listen(app.get("port"), () => { | |
console.log(("App is running at http://localhost:%d in %s mode"), app.get("port"), app.get("env")); | |
console.log("Press CTRL-C to stop\n"); | |
job.shopRefresh() | |
}); | |
app.on('close', () => { | |
app.removeAllListeners(); | |
}); | |
}) | |
.catch(error => console.log(error)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment