All files / src index.ts

100% Statements 24/24
100% Branches 0/0
100% Functions 0/0
100% Lines 24/24

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54        5x   5x 5x   5x   5x   5x 5x 5x     5x 5x     5x 5x     5x   5x           5x 5x     5x 5x 5x 5x 5x 5x 5x               5x  
/**
 * The Lib
 */
//main service framework
export const Moleculer = require("moleculer");
//service decorators for ES7
import * as MoleculerDecorators from "moleculer-decorators";
export const ServiceDecorators = MoleculerDecorators;
 
export const { loadConfig } = require("my-nconf");
/** Config, based on env */
export const config = loadConfig();
 
export const Promise = require("bluebird");
global.Promise = Promise;
export const _ = require("lodash");
 
/** custom app errors */
export const errors = require("./errors");
export * from "./errors"; //base app errors
 
/** custome app logger */
export * from "./utils/Logger";
import { logger } from "./utils/Logger";
 
/** Service Driver */
import { CreateServiceBroker, CreateServiceStarter } from "./drivers";
//the minium requirements to run service broker,
const DefaultServiceContext = {
  namespace: config.get("namespace"),
  transporter: config.get("transporter.nats"),
  logger
};
//override by extend or provide config to new DefaultServiceBroker(config)
export const ServiceBroker = CreateServiceBroker(DefaultServiceContext);
export const ServiceStarter = CreateServiceStarter(ServiceBroker);
 
/** helper drivers */
export {
  RethinkDB,
  Redis,
  ElasticSearch,
  MongoDB,
  WWW,
  PromClient
} from "./drivers";
 
//export { Kafka } from "./drivers";
 
/**
 * The Service
 */
exports.Service = require("./core.service");