hello bot

This commit is contained in:
2017-02-23 13:35:07 +07:00
parent 435414316d
commit f28ab5f2b9
3 changed files with 38 additions and 1 deletions

24
app.js
View File

@@ -0,0 +1,24 @@
var express = require('express');
var bodyParser = require('body-parser');
var zmrBot = require('./bot.js');
var app = express();
var port = process.env.PORT || 3000;
// body parser middleware
app.use(bodyParser.urlencoded({ extended: true }));
// test route
app.get('/', function (req, res) { res.status(200).send('Hello world!') });
app.post('/hello', zmrBot);
// 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);
});