diff --git a/app.js b/app.js index 4787fd2..bbe7e80 100755 --- a/app.js +++ b/app.js @@ -5,7 +5,7 @@ var bodyParser = require('body-parser'); var https = require('https'); var fs = require('fs'); -var zmrBot = require('./bot.js'); +var helloBot = require('./hello.js'); var app = express(); var sslPath = '/etc/letsencrypt/live/sao.twilightparadox.com/'; @@ -19,9 +19,9 @@ var options = { app.use(bodyParser.urlencoded({ extended: true })); // test route -app.get('/', function (req, res) { res.status(200).send('Hello world!') }); +app.get('/', function (req, res) { res.status(200).send('it works!') }); -app.post('/hello', zmrBot); +app.post('/hello', helloBot); // error handler app.use(function (err, req, res, next) { diff --git a/bot.js b/hello.js similarity index 100% rename from bot.js rename to hello.js diff --git a/localApp.js b/localApp.js new file mode 100644 index 0000000..74ad3fa --- /dev/null +++ b/localApp.js @@ -0,0 +1,21 @@ +var express = require('express'); +var bodyParser = require('body-parser'); + +var app = express(); +var port = 3000; + +// body parser middleware +app.use(bodyParser.urlencoded({ extended: true })); + +// test route +app.get('/', function (req, res) { res.status(200).send('Hello world!') }); + +// error handler +app.use(function (err, req, res, next) { + console.error(err.stack); + res.status(400).send(err.message); +}); + +app.listen(port, function () { + console.log('Slack bot listening on port ' + port); +}); \ No newline at end of file diff --git a/package.json b/package.json index 884609d..88764d7 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "dependencies": { "body-parser": "^1.16.1", "express": "^4.14.1", + "requestify": "^0.2.5", "socket.io": "^1.7.3" } }