🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

node-microsvc-lib

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-microsvc-lib

NodeJS microservice framework library

0.1.18
Source
npm
Version published
Weekly downloads
294
129.69%
Maintainers
1
Weekly downloads
 
Created
Source

node-microsvc-lib

Git Commit Npm Version NPM Vulnerabilities

Installation

npm install node-microsvc-lib --save

Usage

Creating a microservice app:

// app.ts

import {Microservice, ConsoleLogger} from "node-microsvc-lib";

// factories/modules
import {RequestLogger} from "./factories/request_logger";
import {HealthCheck} from "./factories/health_check";
import {TestRestCtrl} from "./factories/rest_service";

// configs
import configs = require("./config/config");

const logger = new ConsoleLogger();

// create microservice appv
const app = new Microservice(configs, logger);

app.register_dependency("logger", logger);

app.register_factory("request_logger", RequestLogger);
app.register_factory("test_rest_ctrl", TestRestCtrl);
app.register_factory("health_check", HealthCheck);

process.on("uncaughtException", (err:Error)=>{
  logger.fatal(err);
});

app.init((err?: Error) => {
  if (err)
     return logger.error(err);

  logger.info("APP STARTED");
});

Pre-requisites for contributing

NVM - Node Version Manager - https://github.com/creationix/nvm

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash

After NVM is installed, execute this to download and install the correct node version:

nvm install 10.15.0

Keywords

node.js

FAQs

Package last updated on 08 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts