/nodame

nodame framework for Node.js

Primary LanguageJavaScriptMIT LicenseMIT

Nodame

npm install nodame

CURRENTLY UNSTABLE!!!


Intro

A Node.js framework built on Express 4.0 with some features to help in increasing development productivity. Nodame uses both third-party and private modules.

It supports cross-platform development! You can freely develop your node team project directly on your laptop without needing a VM or anything!


Prerequisites

  • node.js
  • npm -- installed with node.js
  • mocha -- npm install -g mocha (Only if you are going to use the unit testing)

Installation

Installing Nodame is nothing more simpler than executing npm install nodame.

  1. Create project directory

    mkdir ./new_project && cd ./new_project
  2. Create package.json

    npm init
  3. Install nodame package

    npm install --save nodame@~1.1.0

    Check the release updates for the latest stable version.

  4. Build project's files

    ./node_modules/nodame/build.sh

Run application

You can run your application by executing index.js. Your default project can be accessed through your browser at http://localhost:3000/my-project.

P.S.: You might want to set cookie domain to "", NULL, or FALSE; if you are using localhost as your domain. See Cookie Specification.

Run using node command

node index.js [options]
Option Default Description
-c, --config <file> ./config-devel Config file location
-e, --env <env> development Application environment
-S, --staging Set staging environment
-P, --production Set production environment
-p, --port Set port
-t, --test Run test

Example:

```bash
node index.js --config ~/config/main.ini
```

Run using nodemon

  1. Install nodemon

    npm install -g nodemon

    This will install nodemon globally

  2. Run nodemon

    nodemon index.js [option]

Release updates

Release Version
Stable 1.1.0
Release candidate -

Changes history

  • 1.0.6
    • Fixed Windows assets issue
  • 1.0.5
    • Fixed Windows path issue
  • 1.0.4
    • Added support to cross-platform development
    • Added nodame/path module
  • 1.0.3
    • Added xml parser support to req.body
  • 1.0.2
    • Added support to session token hook
  • 1.0.1
    • Deprecated nodame.service(), changed to nodame.require('service/')
    • Deprecated nodame.middleware(), changed to nodame.require('middleware/')
    • Deprecated nodame.handler(), changed to nodame.require('handler/')
  • 1.0.0
    • Public release to npm
    • Added hook support to run on system boot
  • 0.2.2
    • Added support to set header in request
    • Added support to post XML in request
    • Fixed assets manager bug
  • 0.2.1
    • Changed self passing variable in config file to {{config.name}}
    • Added support to argv
    • Fixed assets manager bug
  • 0.2.0
    • Added support to self passing variable in config file using %config.name%
    • Added support to URL encode in config file using (config_value|encode_url)
    • Removed support to bower
  • 0.1.0
    • Added support to bower
    • Extracted from team's project

Features

  • TODO: Complete this section.

Routes

  • TODO: Complete this section.

Automates routing as defined in config.

Menu

  • TODO: Complete this section.

Auto-config menu.

Handlers

  • TODO: Complete this section.

Handlers.

Services

  • TODO: Complete this section.

Services.

Middlewares

  • TODO: Complete this section.

Middlewares.

Views

  • TODO: Complete this section.

Views.

Assets manager

  • TODO: Complete this section.

Provides automated assets generation of javascript and stylesheet files for production. It minifies and combines assets as defined in config.

Unit testing

  • TODO: Complete this section.

Unit testing using BDD style.

Public methods

  • TODO: Complete this section.

Public methods are methods or objects that can be ran throughout the environment.

nodame

  • nodame.appPath()
    Return application's absolute path.

    var appPath = nodame.appPath();
    // return '/absolute/path/to/app'
  • nodame.argv
    Return argv object

    node index.js --env development
    var env = nodame.argv.env;
    // return 'development'
  • nodame.config()
    Return config's value by passing selector. Please see nodame.settings for direct access to config's object.

    var baseUrl = nodame.config('server.url.base');
    // return server.url.base in config
  • nodame.enforceMobile()
    Middleware to enforce mobile view. Not to be used in application.

  • nodame.env()
    Return application's environment

    var env = nodame.env();
    return 'development'
  • nodame.express() Return new Express' object.

    var express = nodame.express();
    // return new express' object
  • nodame.handler(name string) Deprecated in 1.0.1. Please see nodame.require()

  • nodame.isDev() Return whether it's development environment. Production and staging are considered as non-development environment.

    if (nodame.isDev()) {
        console.log('Hello Dev!');
    }
  • nodame.locals() Middleware to register locals variable. Not to be used in application.

  • nodame.middleware() Deprecated in 1.0.1. Please see nodame.require()

  • nodame.require(name string) Native's require wrapper. You are encouraged to use this method instead of native's method as the native method won't load npm modules imported by nodame and nodame modules.

    var path = nodame.require('path');
    // return native's module path
    var request = nodame.require('nodame/request');
    // return nodame module request
    var foo = nodame.require('module/foo');
    // return custom module foo as located in /modules
  • nodame.router() Return new express.Router().

    var router = nodame.router();
    // return express.Router()
  • nodame.service(name string) Deprecated in 1.0.1. Please see nodame.require()

  • nodame.set(name string, obj object) Register object to nodame.settings.__systems. Not to be used in application.

  • nodame.settings Return settings value directly. This is a call to nodame.setting. You can use this to return config value directly by using nodame.settings.config, for calling config indirectly please see nodame.config().

    var baseUrl = nodame.settings.config.server.url.base;
    // return server.url.base
  • nodame.sysPath() Return system's path. Not to be used in application.

sprintf

  • sprintf(string format , [mixed arg1 [, mixed arg2 [ ,...]]]) Public method to sprintf

    var foo = 'wooof';
    var bar = 'booo!';
    var str = sprintf('It sounds like %s but actually %s', foo, bar);
    // return 'It sounds like wooof but actually booo!'
  • vsprintf() Same as sprintf() but accept arrays.

    var foo = vsprintf('The first 4 letters of the english alphabet are: %s, %s, %s and %s', ['a', 'b', 'c', 'd']);
    // return 'The first 4 letters of the english alphabet are: a, b, c, d'

Modules

Nodame comes with third-party modules and private modules which can be used using nodame.require().

Third party modules

Name Version
async ~0.9.0
body-parser ~1.10.2
colors ~1.0.3
commander ~2.8.1
cookie-parser ~1.3.3
debug ~2.1.1
express ~4.11.1
express-device ~0.3.11
express-xml-bodyparser ~0.0.7
js-sha512 ^0.2.2
jumphash ^0.2.2
log ~1.4.0
mandrill-api ~1.0.41
md5 ^2.0.0
measure ^0.1.1
method-override ~2.3.2
morgan ~1.5.2
node-dogstatsd 0.0.6
node-uuid ~1.4.3
numeral ~1.5.3
parse-duration ^0.1.1
query-string ~1.0.0
raven ^0.7.3
redis ~0.12.1
serve-static ~1.9.2
sprintf-js ~1.0.2
swig ~1.4.2
validate.js ~0.6.1

Private modules

Datadog

Date

File

HTML

JsonApi

Linked

Locale

Mailer

Redis

Request

Secret

Session

String

View

<> with ❤︎ by ドラえもん