some changes

This commit is contained in:
2017-02-23 16:55:13 +07:00
parent b246e0f1ca
commit 4aae137b08
4 changed files with 25 additions and 3 deletions

6
app.js
View File

@@ -5,7 +5,7 @@ var bodyParser = require('body-parser');
var https = require('https'); var https = require('https');
var fs = require('fs'); var fs = require('fs');
var zmrBot = require('./bot.js'); var helloBot = require('./hello.js');
var app = express(); var app = express();
var sslPath = '/etc/letsencrypt/live/sao.twilightparadox.com/'; var sslPath = '/etc/letsencrypt/live/sao.twilightparadox.com/';
@@ -19,9 +19,9 @@ var options = {
app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.urlencoded({ extended: true }));
// test route // 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 // error handler
app.use(function (err, req, res, next) { app.use(function (err, req, res, next) {

View File

21
localApp.js Normal file
View File

@@ -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);
});

View File

@@ -11,6 +11,7 @@
"dependencies": { "dependencies": {
"body-parser": "^1.16.1", "body-parser": "^1.16.1",
"express": "^4.14.1", "express": "^4.14.1",
"requestify": "^0.2.5",
"socket.io": "^1.7.3" "socket.io": "^1.7.3"
} }
} }