This repository has been archived by the owner on May 7, 2019. It is now read-only.
forked from dcsan/gitterbot
-
Notifications
You must be signed in to change notification settings - Fork 51
/
app.js
63 lines (44 loc) · 1.43 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*jshint globalstrict:true, trailing:false, unused:true, node:true */
"use strict";
// var clc = require("cli-color");
//process.stdout.write(clc.erase.screen);
require('dotenv').config({path: 'dot.env'});
console.log("--------------- startup ------------------")
if (typeof Map !== "function" ) {
throw new Error("ES6 is required; add --harmony");
}
require("./lib/patch/StringPatch.js");
var express = require("express");
var port = process.env.PORT || 7891;
var passport = require("./lib/gitter/passportModule");
// other requires
var GBot = require("./lib/bot/GBot"),
routes = require("./lib/app/routes.js");
//should be loaded before Bonfires for wikihints
var KBase = require('./lib/bot/KBase');
var Bonfires = require('./lib/app/Bonfires');
// Utils.cls();
// Client OAuth configuration
var app = express();
// Middlewares
app.set("view engine", "jade");
app.set("views", __dirname + "/views");
app.use(express.json());
app.use(express.urlencoded());
app.use(express.static(__dirname + "/public"));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.cookieParser());
app.use(express.session({
secret: "keyboard cat"
}));
app.use(passport.initialize());
app.use(passport.session());
app.use(app.router);
GBot.init();
routes.init(app, GBot, passport);
// GBot.updateRooms();
// needs a room
// GBot.sendReply("menu");
app.listen(port);
console.log("Demo app running at http://localhost:" + port);