Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
bin
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

express-crud

Demonstrate the structuring of an Express.JS application

Getting Started

Checkout and change into directory. Then execute:

npm install
npm start

Overview

Create the directory structure for each module:

    my_module
        +-- index.js
        +-- model.js
        +-- routes.js

The index.js exports only the stuff that you want to be exposed to the outside of the module to ensure data encapsulation:

    module.exports = {
        routes: require('./routes')
    };

In your app.js, import the module and use routes (or other objects) from the module:

    var my_module = require('./my_module');
    app.use('/my_module', my_module.routes);

About

Demonstrate the structuring of an Express.JS application

Resources

Releases

No releases published

Packages

No packages published