nodestack-express

0.5.1 • Public • Published

About

This is a simple nodejs-express site system that standardizes configuration for the specific use of express for simple, localised homepages that only use nodejs technologies.

It presets browserify, jade and stylus so you just need to create those folders and you are good to go.

It also set's up a locale system that should allow you to have a localised system setup in a jiffy!

Setup

Install this to your new project with

$ npm i nodestack-express --save

Then setup your server.js with

"use strict";

var site = require('nodestack-express');

site(__dirname,function (app) {
    app.getLocalised('/subpage', function(req, res, localeId, options) {
        // localeId ... en, de or ja
        // options .... Options with i18n settings added (will use the options object from the next line if given)
    }, options);
    app.getPage('/subpage', 'view', {me: true}); // Automatically renders a localised view
});

Configuration

You can setup your server by creating either a config.json, config.ini or config.yaml file. All content of those variables will be available in your jade template. It will also be used to setup your server. Common important variables are

  • locales A list of locales that are supported by your site (format: {id: , name: })
  • PORT Port for your server to start
  • devMode If the server is started in dev mode

The system differnciates between configurations for various environments. The default environment is "dev". You have to make sure that there is a config.dev.json in your project root from which it can load the development configuration. If you want to support different environments all you need to do is add another config.x.json file in your root.

You can change environments by either setting the environment variable "ENV" to something different, by defining a argument when starting the server like:

$ node server.js --env=prod

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.5.11latest

Version History

VersionDownloads (Last 7 Days)Published
0.5.11
0.5.00
0.4.00
0.3.51
0.3.40
0.3.31
0.3.20
0.3.10
0.3.00
0.2.20
0.2.10
0.2.00
0.1.50
0.1.40
0.1.30
0.1.20
0.1.10
0.1.00
0.0.110
0.0.100
0.0.90
0.0.80
0.0.70
0.0.60
0.0.50
0.0.40
0.0.33
0.0.20
0.0.10
0.0.00

Package Sidebar

Install

npm i nodestack-express

Weekly Downloads

6

Version

0.5.1

License

ISC

Last publish

Collaborators

  • leichtgewicht
  • atuyl