-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Https server ? #182
Comments
I have extend the BootBot class for https server. class HttpsBootBot extends BootBot {
constructor(option) {
super(option);
}
startHttps(credentials, port) {
console.log('BOT Https');
this.httpsServer = https_1.default.createServer(credentials, this.app);
this.start(port);
}
start(port) {
this._initWebhook();
this.app.set('port', port || 3000);
if (this.httpsServer) {
this.httpsServer.listen(this.app.get('port'), () => {
const portNum = this.app.get('port');
console.log('BootBot running on port', portNum);
console.log(`Facebook Webhook running on localhost:${portNum}${this.webhook}`);
});
}
else {
console.log('error extend bootbot start');
}
}
close() {
if (this.httpsServer) {
this.httpsServer.close();
}
else {
console.log('error extend bootbot stop');
}
}
} Insted of call const privateKey = fs.readFileSync(env_1.config.tls.key, 'utf8');
const certificate = fs.readFileSync(env_1.config.tls.cert, 'utf8');
const credentials = { key: privateKey, cert: certificate };
new HttpsBootBot(...).startHttps(credentials, port); |
Hey @mrpinkcat, I think that's a solid solution. Thanks for sharing! If you'd like to add the option to BootBot itself, feel free to open a PR and tag me on it. |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can I use https server with certificate insted express http server ? @Charca
The text was updated successfully, but these errors were encountered: