actionhero
Version:
The reusable, scalable, and quick node.js API server for stateless and stateful applications
23 lines (22 loc) • 762 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RandomNumber = void 0;
const index_1 = require("./../index");
class RandomNumber extends index_1.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 }) {
const randomNumber = Math.random();
const stringRandomNumber = connection.localize([
"Your random number is {{randomNumber}}",
// @ts-ignore
{ randomNumber },
]);
return { randomNumber, stringRandomNumber };
}
}
exports.RandomNumber = RandomNumber;