express-micro-service

Easy microservices powered by Express.

this package was renamed to mirco
Last updated 3 years ago by maximilianschmitt .
MIT · Repository · Bugs · Original npm · Tarball
$ cnpm install express-micro-service 
SYNC missed versions from official npm registry.

express-micro-service

Travis Build

Easy microservices powered by Express.

Installation

$ npm install express-micro-service

Usage

Check out the tests for more information on what you can do with express-micro-service.

Server

'use strict';

let service = require('express-micro-service');

let server = service({
  hello: function(payload) {
    return 'Hello, ' + payload.name;
  }
}, [
  {
    method: 'hello',
    returns: 'greeting'
  }
]);

server.listen(process.env.SERVICE_PORT);

Client

'use strict';

let axios = require('axios');

axios
  .post('http://localhost:' + process.env.SERVICE_PORT + '/hello', {
    name: 'Max'
  })
  .then(res => {
    console.log(res.data); // { greeting: 'Hello, Max' }
  });
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (6)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |