mirror of
https://github.com/Dannecron/hello-slack-bot.git
synced 2025-12-26 00:22:35 +03:00
21 lines
501 B
JavaScript
21 lines
501 B
JavaScript
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);
|
|
}); |