mostly-poplarjs
MostlyJS microservice integration of poplarjs
Last updated 2 years ago by forafish .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install mostly-poplarjs 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.0.9                                ...           latest (2 years ago)

10 Versions

  • 1.0.9                                ...           2 years ago
  • 1.0.8                                ...           3 years ago
  • 1.0.7                                ...           3 years ago
  • 1.0.6                                ...           3 years ago
  • 1.0.5                                ...           3 years ago
  • 1.0.4                                ...           3 years ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 10
Dependencies (10)
Dev Dependencies (11)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |