@betit/orion-node-sdk
Advanced tools
Comparing version 1.0.0-beta.9 to 1.0.0-beta.10
@@ -7,6 +7,7 @@ "use strict"; | ||
const LoggerLevels = require("./levels"); | ||
class Logger { | ||
constructor(_serviceName) { | ||
this._serviceName = _serviceName; | ||
this._vernose = process.argv.indexOf('--verbose') !== 0; | ||
this._vernose = process.argv.indexOf('--verbose') !== -1; | ||
this._client = new graylog({ | ||
@@ -13,0 +14,0 @@ host: process.env.ORION_LOGGER_HOST || '127.0.0.1', |
{ | ||
"name": "@betit/orion-node-sdk", | ||
"version": "1.0.0-beta.9", | ||
"version": "1.0.0-beta.10", | ||
"description": "SDK for orion microservice", | ||
@@ -15,3 +15,4 @@ "license": "MIT", | ||
"lint": "tslint --config tslint.json src/**/*.ts --exclude src/**/*.d.ts", | ||
"ghpages": "npm run site && gh-pages -d public" | ||
"ghpages": "npm run site && gh-pages -d public", | ||
"postpublish": "greenkeeper-postpublish" | ||
}, | ||
@@ -18,0 +19,0 @@ "dependencies": { |
@@ -0,4 +1,40 @@ | ||
[![NPM version][npm-image]][npm-url] | ||
[![Build Status][travis-image]][travis-url] | ||
[![Test coverage][coveralls-image]][coveralls-url] | ||
## Installation | ||
```sh | ||
$ npm install @betit/orion-node-sdk | ||
``` | ||
## Basic example | ||
### Note - You will need to have running all of the orion (dependencies)[https://github.com/betit/orion/tree/dev#development] | ||
In `foo.js` write the following: | ||
```js | ||
const ORION = require('@betit/orion-node-sdk'); | ||
const FOO = new ORION.Service('foo'); | ||
const BAR = new ORION.Service('bar'); | ||
FOO.handle('get', (req, reply) => { | ||
reply(new ORION.Response('foo')); | ||
}); | ||
FOO.listen(() => { | ||
FOO.logger.createMessage('ready').send(); | ||
const REQ = new ORION.Request('/foo/get'); | ||
BAR.call(REQ, res => { | ||
// do stuff | ||
}); | ||
}); | ||
``` | ||
And run it like that: `node foo.js --verbose` | ||
You can find more detailed examples in the `examples` folder. | ||
## Tests | ||
@@ -17,2 +53,4 @@ | ||
[npm-image]: https://badge.fury.io/js/%40betit%2Forion-node-sdk.svg | ||
[npm-url]: https://www.npmjs.com/package/@betit/orion-node-sdk | ||
[travis-image]: https://travis-ci.org/betit/orion-node-sdk.svg?branch=master | ||
@@ -19,0 +57,0 @@ [travis-url]: https://travis-ci.org/betit/orion-node-sdk/ |
41469
59