Skip to content

microservice-framework/microservice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

microservice

Gitter npm microservice-frame.work

Microservice framework worker class.

Simple example:

'use strict';

const Cluster = require('@microservice-framework/microservice-cluster');
const Microservice = require('@microservice-framework/microservice');

require('dotenv').config();

var mservice = new Microservice({
  mongoUrl: process.env.MONGO_URL + process.env.MONGO_PREFIX + process.env.MONGO_OPTIONS,
  mongoTable: process.env.MONGO_TABLE,
  secureKey: process.env.SECURE_KEY,
  schema: process.env.SCHEMA
});

var mControlCluster = new Cluster({
  pid: process.env.PIDFILE,
  port: process.env.PORT,
  hostname: process.env.HOSTNAME,
  count: process.env.WORKERS,
  callbacks: {
    validate: mservice.validate,
    POST: mservice.post,
    GET: mservice.get,
    PUT: mservice.put,
    DELETE: mservice.delete,
    SEARCH: mservice.search
  }
});

For more details please check our website

Changelog

  • 1.3.0 - open mongo connection on class init, instead of each request.
  • 1.3.1 - bug fix.
  • 1.3.2 - implements events error and ready.
  • 1.3.3-5 - Implementing new access token validation mechanism
  • 1.3.6 - fix Access-token check.
  • 1.3.7 - Add ObjectID like field defenition.
  • 1.3.8 - Fix removing _id from output when _id specified as field.