@baristaio/espresso
The Espresso micro service wrapper (express based)
Last updated 3 months ago by baristajs .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @baristaio/espresso 
SYNC missed versions from official npm registry.

IN DEVELOPMENT: PLEASE DON'T USE

espresso

The micro service wrapper

The espresso is a NodeJS service wrapper for controllers.

This service provides following goodies:

  • access validation JWT based
  • context log
  • service log
  • connections
    • Redis
    • Mongo
    • Neo4J
    • Other
  • controllers routing
  • registration in service manager - Barista

Install

npm i

API

ServiceDescriptor

  • Service name
  • config
  • routes

Espresso API

  • register (serviceDescriptor): registration the service in Barista

    • registration running after installation
  • createInstance(ServiceDescriptor) -> create the service instance with:

    • logger
    • db connection pool
  • isAvailable: return status

Service API

  • Service properties
    • token (JWT): received from Barista

      • service name
      • env (environment)
      • instance ID
    • start:

      • mode: (test, local, debug, prod) return status
    • stop

    • routes: { route: "route", controller: "controller" }

    • persistence

      • getClient
        • Mongo
        • Redis
        • Neo4J

Controller API

ControllerDescriptor

{
    "name": "string",
    "route": "string",
    "req": "request",
    "res": "response",
    "next": "next" ,
    "callback": "function",
    "connections": ["mongoClient", "redisClient", "etc"]
}

Resources

Resources = { Mongo, Mongoose, Redis, NeoJ4 }

  • getResource(Resources.Mongo)

JWT

Examples

const espresso = required('espresso');
const controller = required('./controllers/<your controller>');

const service = espresso.getService({
    name: 'myService',
});

service.start();

service.stop('reason');

for run example please use node parameters: -r babel-register:

npm i

cd example

node -r babel-register simple.js

the service will stoped after 1 minute.

Current Tags

  • 0.0.23                                ...           latest (3 months ago)

23 Versions

  • 0.0.23                                ...           3 months ago
  • 0.0.22                                ...           3 months ago
  • 0.0.21                                ...           3 months ago
  • 0.0.20                                ...           3 months ago
  • 0.0.19                                ...           8 months ago
  • 0.0.18                                ...           8 months ago
  • 0.0.17                                ...           8 months ago
  • 0.0.16                                ...           8 months ago
  • 0.0.15                                ...           8 months ago
  • 0.0.14                                ...           8 months ago
  • 0.0.13                                ...           8 months ago
  • 0.0.12                                ...           8 months ago
  • 0.0.11                                ...           9 months ago
  • 0.0.10                                ...           10 months ago
  • 0.0.9                                ...           10 months ago
  • 0.0.8                                ...           10 months ago
  • 0.0.7                                ...           a year ago
  • 0.0.6                                ...           a year ago
  • 0.0.5                                ...           a year ago
  • 0.0.4                                ...           a year ago
  • 0.0.3                                ...           a year ago
  • 0.0.2                                ...           a year ago
  • 0.0.1                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 24
Last Month 51
Dependencies (17)
Dev Dependencies (6)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |