-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
34 lines (23 loc) · 856 Bytes
/
server.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
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
// set the port of our application
// process.env.PORT lets the port be set by Heroku
var port = process.env.PORT || 8082;
// make express look in the public directory for assets (css/js/img)
app.use(express.static(__dirname + '/client/app'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
// set the home page route
app.get('/', function(req, res) {
// make sure index is in the right directory. In this case /app/index.html
res.render('index');
});
// for heroku config vars
app.get('/config.js', function(req, res){
res.write("var API_KEY='"+process.env.API_KEY+"'" + '\n');
res.end();
});
app.listen(port, function() {
console.log('Our app is running on http://localhost:' + port);
});