Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@pajtai
Last active July 20, 2018 05:32
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 pajtai/119674023fdb3a0e5822747e9129933e to your computer and use it in GitHub Desktop.
Save pajtai/119674023fdb3a0e5822747e9129933e to your computer and use it in GitHub Desktop.
const app = {};
consign()
.include('api')
.into(app);
const flattened = flatten(app);
Object.entries(flattened).forEach(([route, router]) => {
const baseRoute = `/${route.replace(/\.controller$/, '').replace(/\./g, '/')}`;
server.use(baseRoute, router);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment