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;