Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/maximilianschmitt/mirco

Easy microservices for node.js.
https://github.com/maximilianschmitt/mirco

Last synced: 3 months ago
JSON representation

Easy microservices for node.js.

Awesome Lists containing this project

README

        

# mirco

![Travis Build](http://img.shields.io/travis/maximilianschmitt/mirco.svg?style=flat)

Easy microservices for node.js.

## Installation

```
$ npm install mirco
```

## Usage

Check out the tests for more information on what you can do with mirco.

### Server

```js
'use strict';

let service = require('mirco');

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

server.listen(process.env.SERVICE_PORT);
```

### Client

```js
'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' }
```