UNPKG

jetstream-microservice

Version:

Jetstream Node Package for easy implementation of Jetstream microservices

69 lines (49 loc) 1.23 kB
# Jetstream microservice ## New in v0.1.6 - Shorten key expiration to 5s - Add tests for JWT signing ## New in v0.1.1 ### Inter-service security added Security now added to contact other services, use the Jetstream's version of request rather than request itself ```javascript var jetstream = require('jetstream-microservice'); jetstream.request(options, next); ``` Remove inbound security ```javascript process.env.IGNORE_JWT_SECURITY = "false"; ``` # Getting started Create a Jetstream service easily You will need Jetstream core up and running to get this to work correctly. First install express and jetstream-microservice ```bash $ npm install --save express $ npm install --save jetstream-microservice ``` Then create a simple *index.js* file... ```javascript var express = require('express'); var app = express(); var jetstream = require('jetstream-microservice'); var port = 5099; var options = { name: "test-service", location: "http://localhost:" + port } jetstream.init(app, options); var server = app.listen(port); ``` And run... ```bash $ node index.js ``` # Running tests Default with summary only: ``` $ npm test ``` To see verbose test output, execute: ``` $ npm run test:detailed ```