Skip to content

Instantly share code, notes, and snippets.

@rzvdaniel
Last active July 6, 2019 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rzvdaniel/adbc8104afd712f17267502af62ee4e6 to your computer and use it in GitHub Desktop.
Save rzvdaniel/adbc8104afd712f17267502af62ee4e6 to your computer and use it in GitHub Desktop.
[Medium] Moleculer Routing - Default Configuration
// greeter.service.js
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