-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapp.js
55 lines (46 loc) · 1.63 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
var express = require('express'),
routes = require('./routes'),
content = require('./routes/content'),
snapshot = require('./routes/snapshot'),
stocks = require('./routes/stocks'),
swig = require('swig'),
path = require('path');
var app = express();
var server = require('http').createServer(app),
io = require('socket.io').listen(server);
app.set('port', process.env.PORT || 3000);
app.set('views', path.join(__dirname, 'views'));
app.engine('html', swig.renderFile);
app.set('view engine', 'html');
app.set('view cache', false);
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.json());
app.use(express.urlencoded());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));
// Development only
if ('development' == app.get('env')) {
app.use(express.errorHandler());
swig.setDefaults({
cache: false
});
}
// Main UI routes
app.get('/', routes.index);
app.get('/stocks/add', stocks.index);
app.get('/snapshot/:symbol', snapshot.index);
// API Endpoints
app.get('/api/sentiments/:symbol', content.sentiments);
app.get('/api/quotes/:symbol', content.quotes);
app.get('/api/currentprice/:symbol', content.currentPrice);
app.get('/api/content/:symbol', content.fool);
app.get('/api/trending/', content.trendingSymbols);
app.get('/api/tweets/:symbol', content.tweets);
app.get('/api/tweetwordcount/:symbol', content.tweetWordCount);
app.get('/api/capsratings/:symbol', content.capsRatings);
var port = process.env.PORT || 3000;
app.listen(port, function() {
console.log('Express server listening on port ' + app.get('port'));
});