Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #252 from m4olivei/facebook-static-config
Browse files Browse the repository at this point in the history
Allow a configurable directory to serve static files for Facebook based bots
  • Loading branch information
anonrig committed Jun 2, 2016
2 parents ab2780f + 113a7eb commit 30f21f0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/Facebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,17 @@ function Facebookbot(configuration) {
throw new Error('Specified port is not a valid number');
}

var static_dir = __dirname + '/public';

if (facebook_botkit.config && facebook_botkit.config.webserver && facebook_botkit.config.webserver.static_dir)
static_dir = facebook_botkit.config.webserver.static_dir;

facebook_botkit.config.port = port;

facebook_botkit.webserver = express();
facebook_botkit.webserver.use(bodyParser.json());
facebook_botkit.webserver.use(bodyParser.urlencoded({ extended: true }));
facebook_botkit.webserver.use(express.static(__dirname + '/public'));
facebook_botkit.webserver.use(express.static(static_dir));

var server = facebook_botkit.webserver.listen(
facebook_botkit.config.port,
Expand Down

0 comments on commit 30f21f0

Please sign in to comment.