yunghoy / island

An opinionated, full-stacked Microservices framework for node, powered by TypeScript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is a branch for preparing release 1.0 - check the milestone

island v1.0

An opinionated, full-stacked Microservices framework for node, powered by TypeScript.

Build Status NPM version Dependency Status Coverage Status Test Coverage Code Climate Issue Count

import * as island from 'island';
import * as keeper from 'island-keeper';
import { EndpointController } from './controller/endpoint.controller';
import { EventController } from './controller/event.controller';

const serviceName = 'hawaii';

class HawaiiIslet extends island.Islet {
  main() {
    const islandKeeper = keeper.IslandKeeper.getInst();
    islandKeeper.init('consul', 'island');
    islandKeeper.setServiceName(serviceName);

    const amqpChannelPoolAdapter = new island.AmqpChannelPoolAdapter({url: 'amqp://rabbitmq:5672'});
    this.registerAdapter('amqpChannelPool', amqpChannelPoolAdapter);
    const rpcAdapter = new island.RPCAdapter({amqpChannelPoolAdapter, serviceName});
    rpcAdapter.registerController(EndpointController);
    this.registerAdapter('rpc', rpcAdapter);

    const eventAdapter = new island.EventAdapter({amqpChannelPoolAdapter, serviceName});
    eventAdapter.registerController(EventController);
    this.registerAdapter('event', eventAdapter);
  }
}

island.Islet.run(HawaiiIslet);

Table of Contents

Installation

$ npm install island --save

Features

  • Free from service discovery
  • Support various types of communication
    • RPC(strong link between islands)
    • Event(weak link between islands)
    • Push messaging(to user) via socket.io
  • Ensure that each island gets proper parameters
  • Track communications per each request
  • Chain contexts with UUID per each request

v1.0

Changes

  • Loggers is no longer a part of island -> island-loggers #14
  • Di is no longer a part of island -> island-di #16
  • @endpoint decorator now provides 4 more methods #28
    • @endpoint('GET /test') still works
    • @endpoint.get('/test') - You can omit the GET method
    • @endpoint.post('/test') - You can omit the POST method
    • @endpoint.put('/test') - You can omit the PUT method
    • @endpoint.del('/test') - You can omit the DEL method

Breaking Changes

Building

In order to build the island, ensure that you have Git and Node.js installed.

Clone a copy of the repo:

$ git clone https://github.com/spearhead-ea/island.git

Change to the island directory:

$ cd island

Install prerequisites and dev dependencies:

$ npm install -g gulp typescript
$ npm install

Tests

To run the test suite, first install the dependencies, then run npm test:

$ npm install
$ RABBITMQ_HOST=localhost npm test

Environment Variables

Environment Notes
NODE_ENV When development, allows APIs which has options.developmentOnly
HOSTNAME TraceLog uses this as a name of node
ISLAND_RPC_EXEC_TIMEOUT_MS Timeout during execution (Defaults to 25000)
ISLAND_RPC_WAIT_TIMEOUT_MS Timeout during call (Defaults to 60000)
ISLAND_LOGGER_LEVEL Logger level of category island
ISLAND_TRACEMQ_HOST MQ(formatted by amqp URI) for TraceLog. If omitted it doesn't log
ISLAND_TRACEMQ_QUEUE A queue name to log TraceLog

Milestones

For details on our planned features and future direction please refer to our milestones

People

The original author of island is Wonshik Kim

The current lead maintainer is Kei Son

List of all contributors

License

MIT

About

An opinionated, full-stacked Microservices framework for node, powered by TypeScript.

License:MIT License


Languages

Language:TypeScript 97.8%Language:JavaScript 2.0%Language:Shell 0.1%