Skip to content

Instantly share code, notes, and snippets.

@rzvdaniel
Last active April 26, 2019 16:19
Show Gist options
  • Save rzvdaniel/5c817a4e7d2b59d6b5dadd8113979cee to your computer and use it in GitHub Desktop.
Save rzvdaniel/5c817a4e7d2b59d6b5dadd8113979cee to your computer and use it in GitHub Desktop.
[Medium] Moleculer Mixins - A short introduction - greeter.service.js
"use strict";
module.exports = {
name: "greeter",
/**
* Actions
*/
actions: {
/**
* Say a 'Hello'
*
* @returns
*/
hello() {
return "Hello Moleculer";
},
/**
* Welcome a username
*
* @param {String} name - User name
*/
welcome: {
params: {
name: "string"
},
handler(ctx) {
return `Welcome, ${ctx.params.name}`;
}
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment