UNPKG

ask-cli-x

Version:

Alexa Skills Kit (ASK) Command Line Interfaces

22 lines (21 loc) 514 B
"use strict"; const http = require("http"); module.exports = class LocalHostServer { constructor(PORT) { this.port = PORT; this.server = null; } create(requestHandler) { this.server = http.createServer(requestHandler); } listen(callback) { this.server.listen(this.port, callback); } registerEvent(eventName, callback) { this.server.on(eventName, callback); } destroy() { this.server.close(); this.server.unref(); } };