@microservice-framework/microservice

Microservice framework worker class.

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
17Oct 18, 2020Jul 14, 2016Minified + gzip package size for @microservice-framework/microservice in KB

Readme

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.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.