Skip to content

Instantly share code, notes, and snippets.

@shahzadns
Last active January 23, 2017 19:19
Show Gist options
  • Select an option

  • Save shahzadns/fe736b02d5149b832737a055422b2f0e to your computer and use it in GitHub Desktop.

Select an option

Save shahzadns/fe736b02d5149b832737a055422b2f0e to your computer and use it in GitHub Desktop.

Revisions

  1. shahzadns revised this gist Jan 19, 2017. No changes.
  2. shahzadns revised this gist Jan 19, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions nodejs-enhanced-cjs-pattern
    Original file line number Diff line number Diff line change
    @@ -32,10 +32,12 @@ This gist proposes an enhanced CommonJS module declaration pattern for nodeJS/ex
    /*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*/
    //...
  3. shahzadns revised this gist Jan 19, 2017. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions nodejs-enhanced-cjs-pattern
    Original file line number Diff line number Diff line change
    @@ -8,12 +8,12 @@ Description:
    This gist proposes an enhanced CommonJS module declaration pattern for nodeJS/express modules.
    */

    //(all core imports,requires should be list here. e.g "fs", etc)
    //(all core imports,requires should be listed here. e.g "fs", etc)
    /*core modules*/
    //...


    //(all external imports,requires should be list here. e.g "express", etc)
    //(all external imports,requires should be listed here. e.g "express", etc)
    /*external modules*/
    //...

    @@ -28,7 +28,7 @@ This gist proposes an enhanced CommonJS module declaration pattern for nodeJS/ex
    //...


    //(all routes, or anything similar should be list together, along with ref to their handlers here)
    //(all routes, or anything similar should be listed together, along with ref to their handlers here)
    /*routes list*/
    //...

  4. shahzadns revised this gist Jan 19, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions nodejs-enhanced-cjs-pattern
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,7 @@ This gist proposes an enhanced CommonJS module declaration pattern for nodeJS/ex
    //...


    //(all module-scoped local vars, lets, should be list here.)
    //(all module-scoped local vars, lets, should be listed here.)
    /*locals*/
    //...

    @@ -36,7 +36,7 @@ This gist proposes an enhanced CommonJS module declaration pattern for nodeJS/ex
    /*exports*/
    //...

    //(all handlers (routes, utils) should be list here.)
    //(all handlers (routes, utils) should be listed here.)
    /*functions declarations*/
    //...

  5. shahzadns revised this gist Jan 19, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions nodejs-enhanced-cjs-pattern
    Original file line number Diff line number Diff line change
    @@ -39,3 +39,4 @@ This gist proposes an enhanced CommonJS module declaration pattern for nodeJS/ex
    //(all handlers (routes, utils) should be list here.)
    /*functions declarations*/
    //...

  6. shahzadns revised this gist Jan 19, 2017. No changes.
  7. shahzadns created this gist Jan 19, 2017.
    41 changes: 41 additions & 0 deletions nodejs-enhanced-cjs-pattern
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@

    /*
    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 list here. e.g "fs", etc)
    /*core modules*/
    //...


    //(all external imports,requires should be list here. e.g "express", etc)
    /*external modules*/
    //...


    //(all module-scoped local vars, lets, should be list here.)
    /*locals*/
    //...


    //(any initialization(s) should be written here.)
    /*initialization*/
    //...


    //(all routes, or anything similar should be list 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 list here.)
    /*functions declarations*/
    //...