@make-it-saas/api
This is the framework to develop API for a multi-service architectures
Last updated 10 months ago by make-it-saas .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @make-it-saas/api 
SYNC missed versions from official npm registry.

Make it SaaS - API Service

This is the framework to develop API for multi-service architectures. Main features :

  • Authentication using a separated oauth server (with jwt and jwk)
  • Database ORM
  • Cache
  • Queues (Pub/Sub)
  • todo: Health checker
  • todo: API Gate (proxy http.s and ws.s) + editor
  • todo: Jupyter

Getting started

  1. Install devkit
  2. Install authentication instance
  3. Then you can setup your new service :
git clone https://github.com/makeitsaas/makeitsaas-microservice my-service
cd my-service
npm install @make-it-saas/api
# todo : cli
npm start

Resolvers

Functions that can be binded to routes and have access to the ResolverContext :

context = {
  request: {headers, body, params, query, tracker}, # usual parameters but might only be tracker because headers determines the function to call and body its arguments
  var: {}, # custom variables
  user: {},
  services: {},
  models: {},
  databases: {
    db_name: {queryPool, sequelize, ...}
  },
  cache: {get, set},
  queue: {emit, codes},  # listen se paramètre dans la config, qui appelle un hook
  notify: {send},
  health: {check(serviceName)}
}

Cache

framework.cache.set('holidays', {beach: 'volley'});

let subExample = framework.queue.observable('channel-one').subscribe(message => {
console.log('get this message', message);
framework.cache.get('holidays').then(value => console.log('holidays :', value)).catch(err => console.log('error', err));
});

setTimeout(() => framework.queue.publish('channel-one', {foo: 'bar'}), 1000)
setTimeout(() => framework.queue.publish('channel-one', {foo2: 'bar2'}), 2000)
setTimeout(() => (subExample.unsubscribe() || framework.queue.publish('channel-one', {foo3: 'bar3'})), 3000)

Queues Pub/Sub

let subExample = framework.queue.observable('channel-one').subscribe(message => {
    console.log('get this message', message);
    framework.cache.get('holidays').then(value => console.log('holidays :', value)).catch(err => console.log('error', err));
});

setTimeout(() => framework.queue.publish('channel-one', {foo: 'bar'}), 1000)
setTimeout(() => framework.queue.publish('channel-one', {foo2: 'bar2'}), 2000)
setTimeout(() => (subExample.unsubscribe(), framework.queue.publish('channel-one', {foo3: 'bar3'})), 3000)

Routing

# PROJECT_PATH/config/config.yml
- get: /test/authentication
  handler: handler-example.testResolve
  security: security.rule1

Current Tags

  • 0.1.9                                ...           latest (10 months ago)

10 Versions

  • 0.1.9                                ...           10 months ago
  • 0.1.8                                ...           a year ago
  • 0.1.7                                ...           a year ago
  • 0.1.6                                ...           a year ago
  • 0.1.5                                ...           a year ago
  • 0.1.4                                ...           a year ago
  • 0.1.3                                ...           a year ago
  • 0.1.2                                ...           a year ago
  • 0.1.1                                ...           a year ago
  • 0.1.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 1
Dependencies (13)
Dev Dependencies (4)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |