actionhero
Version:
The reusable, scalable, and quick node.js API server for stateless and stateful applications
29 lines (28 loc) • 870 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Console = void 0;
const REPL = require("repl");
const index_1 = require("./../../index");
class Console extends index_1.CLI {
constructor() {
super();
this.name = "console";
this.description =
"Start an interactive REPL session with the api object in-scope";
}
async run() {
await new Promise((resolve, reject) => {
const repl = REPL.start({
prompt: "[ AH::" + index_1.env + " ] >> ",
input: process.stdin,
output: process.stdout,
useGlobal: false,
});
repl.context.api = index_1.api;
repl.on("exit", resolve);
repl.on("error", reject);
});
return true;
}
}
exports.Console = Console;