/itaas-nodejs-tools

common tools for nodejs (callcontext, log implementaion, docker image creation script...)

Primary LanguageJavaScript

iTaaS Node.js Tools

GitHub release Travis David

A collection of tools and utilities for Node.js, maintained by the iTaaS team and used by various iTaaS projects.

Some of its features are designed to be generic enough for any Node.js project, while others are only suited for Express applications.


Table of Contents


Requirements

  • Node.js v4+

Tip: use nvm to install and manage multiple versions of Node.js and npm.

Installation

itaas-nodejs-tools is not published on npm, but you can install it straight from GitHub with the following command:

npm install --save git+https://github.com/agilecontent/itaas-nodejs-tools.git#VERSION

Replace VERSION with the desired version from releases. The latest version is always recommended.

Usage

const tools = require('itaas-nodejs-tools');
const uuid = require('uuid').v4;

let callId = uuid();
let config = { key: "value" };
let logger = tools.createLogger();
let serviceLocator = tools.createServiceLocator();

let context = tools.createCallContext(callId, config, logger, serviceLocator);

Documentation

Read the full docs here.

Development

Developing on Linux is recommended, so you can run integration tests easily with Docker.

Testing

You can run all unit tests with this command:

npm run test-unit

To run all tests, including integration tests, use this command:

npm test

Debugging

Debugging tests can be done with the following script:

npm run test-debug

It will enable Node.js debugger and make it listen on port 5858. You can then use Visual Studio Code or another editor to debug.

Contributing

Everyone is free to open pull requests in this repository.

For more information on how to contribute properly, check these instructions.

Related Projects

These projects use iTaaS Node.js Tools: