UNPKG

actionhero

Version:

actionhero.js is a multi-transport API Server with integrated cluster capabilities and delayed tasks

19 lines (16 loc) 502 B
import { api, Action } from "./../index"; export class RandomNumber extends Action { constructor() { super(); this.name = "randomNumber"; this.description = "I am an API method which will generate a random number"; this.outputExample = { randomNumber: 0.123 }; } async run({ connection, response }) { response.randomNumber = Math.random(); response.stringRandomNumber = connection.localize([ "Your random number is {{randomNumber}}", response, ]); } }