mirror of
https://github.com/Dannecron/hello-slack-bot.git
synced 2025-12-26 00:22:35 +03:00
add https settings and service
This commit is contained in:
13
app.js
13
app.js
@@ -1,9 +1,18 @@
|
||||
var express = require('express');
|
||||
var bodyParser = require('body-parser');
|
||||
var https = require('https');
|
||||
var fs = require('fs');
|
||||
|
||||
var zmrBot = require('./bot.js');
|
||||
|
||||
var app = express();
|
||||
var port = process.env.PORT || 3000;
|
||||
var sslPath = '/etc/letsencrypt/live/sao.twilightparadox.com/';
|
||||
|
||||
var options = {
|
||||
key: fs.readFileSync(sslPath + 'privkey.pem'),
|
||||
cert: fs.readFileSync(sslPath + 'fullchain.pem')
|
||||
};
|
||||
|
||||
// body parser middleware
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
@@ -19,6 +28,10 @@ app.use(function (err, req, res, next) {
|
||||
res.status(400).send(err.message);
|
||||
});
|
||||
|
||||
var server = http.createServer(options, app);
|
||||
var io = require('socket.io').listen(server);
|
||||
server.listen(443);
|
||||
|
||||
app.listen(port, function () {
|
||||
console.log('Slack bot listening on port ' + port);
|
||||
});
|
||||
Reference in New Issue
Block a user