All files / src core.service.ts

90% Statements 9/10
100% Branches 0/0
42.86% Functions 3/7
88.89% Lines 8/9

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 55 56 57 58 59 60 61 625x 5x   5x                                       5x     6x                               5x                     5x             5x  
import { Moleculer, ServiceDecorators, Redis } from "./";
const { Service, Action, Event, Method } = ServiceDecorators;
 
("use strict");
/**
 * !important this has to be in its own file
 * !if this file is changed, the service will reload
 *
 * Service Defination File
 * Use to set up configs, dependencies, events hooks,
 * expose service handlers, etc
 */
//http://moleculer.services/0.12/docs/service.html#Use-decorators
@Service({
	//name: "core", not needed! will be ignored, prefer classname
	version: 1,
	metadata: {
		scalable: true
	},
	dependencies: [],
	mixins: [],
	settings: {}
})
class Core /* service name */ extends Moleculer.Service {
	// Optional constructor
	constructor(broker, schema) {
		super(broker, schema);
	}
	started() {
		// Reserved, fired when started
	}
 
	created() {
		// Reserved, fired when created
	}
 
	stopped() {
		// Reserved, fired when stopped
	}
 
	//public actions http://moleculer.services/0.12/docs/service.html#Actions
	@Action()
	foo() {
		return "foo";
	}
	// With options
	@Action({
		cache: false,
		params: {
			a: "number",
			b: "number"
		}
	})
	foo2() {}
 
	hello() {
		// Private
	}
}
 
module.exports = Core;