node package manager
Don’t reinvent the wheel. Reuse code within your team. Create a free org »

otmicro

OT Micro Node.js

OT Micro is a set of commonly used Grunt tasks and a task runner for microservices in Node.js.

Getting started

Installation

npm install otmicro

Directory structure

OT Micro by convention requires the following directory structure:

config/config.coffee
config/env.coffee
config/<env>/config.coffee
lib/
tasks/
gruntfile.coffee
index.coffee

Gruntfile.coffee

app = require 'otmicro'
 
module.exports = (grunt) ->
  app.loadGruntTasks grunt

Index.coffee

app = require 'otmicro'
app.run()

Configuration directory

You can specify simple key/value pairs or connection strings (by specifying name, database type and connection string itself).

The global configuration is loaded in each environment. To specify the environment change it in env.coffee:

module.exports = 'local'

Global configuration (config/config.coffee)

module.exports = (config) ->
  config.set 'serviceName', 'HelloWorldService'

Environment specific configuration (config//config.coffee)

module.exports = (config) ->
  config.addConnectionString 'MyDatabase', 'Mongo', 'mongodb://127.0.0.1:27017/MyDatabase'
  config.set 'serviceName', 'HelloWorldService override'