ns

nodejs-starter

NodeJs Starter Sample

Showing:

Popularity

Downloads/wk

2

Maintenance

No Maintenance Data Available

Package

Dependencies

3

Size (min+gzip)

234.8KB

License

ISC

Type Definitions

Tree-Shakeable

No?

Categories

Readme

NodeJS Starter

Backend flow with best pratics in NodeJS. With this project you'll can use a custom framework inside a organizated flow that allows develop with the best pratics of backend development.

Using NodeJS Starter you can:

  • Manage routers, views and controllers easy;
  • Use a custom framework or library (like Express)
  • Create custom methods

Dependencies

NodeJS Starter needs:

  • Underscore - Underscore is a JavaScript library that provides a whole mess of useful functional programming helpers without extending any built-in objects.
  • RecursiveJS - Load and run modules recursively.
  • Express - Fast, unopinionated, minimalist web framework for Node.js.

Installation

$ git clone https://github.com/mpahenrique/nodejs-starter.git
$ cd nodejs-starter
$ npm install

Structure

routes/
└── sample        # Routes to /sample*
    └── index.js  ## Main file

controllers/      # Controllers
└── sample        ## Controllers to /sample*
    ├── index.js  ### Main file with methods separation
    ├── get.js    ### Treatments for get method
    ├── post.js   ### Treatments for post method
    ├── delete.js ### Treatments for delete method
    └── put.js    ### Treatments for put method

models/           # Models
└── sample        ## Model to /sample*
    └── index.js  ### Main file that export methods (see function doSomething)

views/            # Views
└── sample        ## View to /sample*
    └── index.js  ### Main file that show the information received and processed

util/             # Util methods
└── index.js      ##  Main file with util methods to the project (see function someMethod) 

Starting

'use strict';

const config    = require('./package.json').application
,     recursive = require('recursivejs')
,     express   = require('express')
,     app       = require('./nodeJsStarter');

app
    .use('express', express(), true) // core module
    .load(config.modules) // load modules
    .use((self) => { recursive.run(self.modules.routes, self); }) // load and run routes
    .listen(config.port); // listen http://localhost:port. Default: 3000

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100