@microservice-framework/microservice
v2.0.0
Published
Microservice framework worker class.
Downloads
14
Readme
microservice
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 mechanism1.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.2.0.0
- Fix search by id when it is array. - support header execution-limit to limit execution time - support header force-index to force index search - support for env MAX_TIME_MS to set max exection time for search - support noCount request params to avoid countin total-count on search - properly close mongo connection on SIGINT (mfw stop serviceName)