Skip to content

Instantly share code, notes, and snippets.

@NALAWALAMURTUZA
Created June 15, 2020 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NALAWALAMURTUZA/8863c4964c584b5a4d3beb19f2fa5d55 to your computer and use it in GitHub Desktop.
Save NALAWALAMURTUZA/8863c4964c584b5a4d3beb19f2fa5d55 to your computer and use it in GitHub Desktop.
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