UNPKG

@gluestack-v2/glue-plugin-service-gateway

Version:

Gluestack V2 service Gateway Plugin

96 lines (77 loc) 1.13 kB
"use strict"; /** * @typedef {import('moleculer').ServiceSchema} ServiceSchema Moleculer's Service Schema * @typedef {import('moleculer').Context} Context Moleculer's Context */ /** @type {ServiceSchema} */ module.exports = { name: "greeter", /** * Settings */ settings: { }, /** * Dependencies */ dependencies: [], /** * Actions */ actions: { /** * Say a 'Hello' action. * * @returns */ hello: { rest: { method: "GET", path: "/hello" }, async handler() { return "Hello Moleculer"; } }, /** * Welcome, a username * * @param {String} name - User name */ welcome: { rest: "/welcome", params: { name: "string" }, /** @param {Context} ctx */ async handler(ctx) { return `Welcome, ${ctx.params.name}`; } } }, /** * Events */ events: { }, /** * Methods */ methods: { }, /** * Service created lifecycle event handler */ created() { }, /** * Service started lifecycle event handler */ async started() { }, /** * Service stopped lifecycle event handler */ async stopped() { } };