Last active
January 23, 2017 19:19
-
-
Save shahzadns/fe736b02d5149b832737a055422b2f0e to your computer and use it in GitHub Desktop.
This gist proposes an enhanced CommonJS module declaration pattern for NodeJS.
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
/* | |
Date: Jan 19 2017 | |
title: NodeJS enhanced CJS module pattern | |
author: Shahzad Nawaz | |
email: [email protected] | |
Description: | |
This gist proposes an enhanced CommonJS module declaration pattern for nodeJS/express modules. | |
*/ | |
//(all core imports,requires should be listed here. e.g "fs", etc) | |
/*core modules*/ | |
//... | |
//(all external imports,requires should be listed here. e.g "express", etc) | |
/*external modules*/ | |
//... | |
//(all module-scoped local vars, lets, should be listed here.) | |
/*locals*/ | |
//... | |
//(any initialization(s) should be written here.) | |
/*initialization*/ | |
//... | |
//(all routes, or anything similar should be listed together, along with ref to their handlers here) | |
/*routes list*/ | |
//... | |
//(all module exports(first indirect ones (from another module), then direct ones) should be listed here.) | |
/*exports*/ | |
//... | |
//(all handlers (routes, utils) should be listed here.) | |
/*functions declarations*/ | |
//... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment