1.0.9 • Published 6 years ago

mostly-poplarjs v1.0.9

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

MostlyJS with Poplarjs

Build Status

This module provides quick steps to create MostlyJS microservices with Poplarjs.

Usage

Installation

npm install mostly-poplarjs

Quick Example

Convert your Poplarjs APIs into microservices is easy enough.

Your existing Poplarjs code

// dummy_api.js
const ApiBuilder = poplar.ApiBuilder;
var DummyApi = new ApiBuilder('dummies');
DummyApi.define('info', {...});
....
module.exports = DummyApi;

Wrapping it as standalone server

import nats from 'nats';
import mostly from 'mostly-node';
import poplar from 'mostly-poplarjs';
import dummyApi from './dummy_api';

const trans = new mostly(nats.connect());
trans.ready(() => {
  var app = poplar.create(trans)
    .use(dummyApi)
    .handler();
});

That's all, the service will register itself with NATS and can be called remotely.

RESTful Gateway

To expose the service as RESTful api, you need only setup a simple express gateway server using mostly-poplarjs-rest

License

MIT

1.0.9

6 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago