🚀 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 - npm Package Compare versions

Comparing version

to
0.1.18

13

lib/di_container.js

@@ -70,15 +70,2 @@ /**

exports.DiContainer = DiContainer;
function getArgs(func) {
// First match everything inside the function argument parens.
// @ts-ignore
var args = func.toString().match(/function\s.*?\(([^)]*)\)/)[1];
// Split the arguments string into an array comma delimited.
return args.split(',').map(function (arg) {
// Ensure no inline comments are parsed and trim the whitespace.
return arg.replace(/\/\*.*\*\//, '').trim();
}).filter(function (arg) {
// Ensure no undefined values are added.
return arg;
});
}
//# sourceMappingURL=di_container.js.map

9

lib/tests/index.js

@@ -93,3 +93,12 @@ /**

});
describe("console_logger", () => {
it("normal log", () => {
logger.debug("debug test");
logger.info("info test");
logger.warn("warn test");
logger.error(new Error("new error for error test"), "desc for error test");
logger.fatal("fatal test");
});
});
});
//# sourceMappingURL=index.js.map

14

package.json
{
"name": "node-microsvc-lib",
"version": "0.1.17",
"version": "0.1.18",
"description": "NodeJS microservice framework library",

@@ -15,3 +15,4 @@ "main": "lib/index.js",

"build": "tsc",
"cover": "istanbul cover node_modules/mocha/bin/_mocha lib/tests/index.js -- -R spec"
"cover": "nyc --cache node_modules/.bin/mocha lib/tests/index.js --exit -- -R spec",
"cover_report": "nyc report --reporter=lcov"
},

@@ -30,2 +31,10 @@ "author": "Pedro Sousa Barreto <pedrosousabarreto@gmail.com>",

],
"nyc": {
"check-coverage": true,
"per-file": false,
"lines": 75,
"statements": 75,
"functions": 75,
"branches": 75
},
"files": [

@@ -55,2 +64,3 @@ "lib/**/*"

"mocha": "^5.2.0",
"nyc": "^13.2.0",
"ts-node-dev": "^1.0.0-pre.32",

@@ -57,0 +67,0 @@ "typescript": "^3.2.2"

@@ -1,23 +0,63 @@

# Pre-requisites
NVM - https://github.com/creationix/nvm
NVM install:
```curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash```
# node-microsvc-lib
[![Git Commit](https://img.shields.io/github/last-commit/pedrosousabarreto/node-microsvc-lib.svg?style=flat)](https://github.com/pedrosousabarreto/node-microsvc-lib/commits/master)
[![Npm Version](https://img.shields.io/npm/v/node-microsvc-lib.svg?style=flat)](https://www.npmjs.com/package/node-microsvc-lib)
[![NPM Vulnerabilities](https://img.shields.io/snyk/vulnerabilities/npm/node-microsvc-lib.svg?style=flat)](https://www.npmjs.com/package/node-microsvc-lib)
After NVM is installed, run this to install node:
```nvm install 10.15.0```
# Setup
cd _prj_dir_
npm install
npm run dev || npm run prod
## Installation
# Examples of installs
## Install dependency
npm install -s express
## Install dev dependency (types)
npm install @types/express --save-dev
```bash
npm install node-microsvc-lib --save
```
## Usage
## good readme
https://itnext.io/step-by-step-building-and-publishing-an-npm-typescript-package-44fe7164964c
Creating a microservice app:
```javascript
// 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
```bash
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:
```bash
nvm install 10.15.0
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet