Skip to content

Instantly share code, notes, and snippets.

@stefanocudini
Created November 16, 2022 13:07
Show Gist options
  • Save stefanocudini/d6e7e7a530e36d3c226335d553fed59c to your computer and use it in GitHub Desktop.
Save stefanocudini/d6e7e7a530e36d3c226335d553fed59c to your computer and use it in GitHub Desktop.
function listenLog(app) {
console.log('listen paths', app._router.stack.filter(r => r.route).map(r => `${Object.keys(r.route.methods)[0]} ${r.route.path}`) );
console.log(`listening at http://localhost:${this.address().port}`);
/*
//TODO manage sigterm
process.on('SIGTERM', () => {
console.error('[geocoder-pelias-services] closing...')
serverParser.close();
});*/
}
///example
const app = express = require('express')();
app.listen(8080, listenLog(app));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment