-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
executable file
·69 lines (52 loc) · 2.29 KB
/
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
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
64
65
66
67
68
69
var express = require('express'); // Get modules.
var routes = require('./routes'); // get routing data from routes folder
var http = require('http'); // server
var path = require('path');
var fs = require('fs');
var AWS = require('aws-sdk');
var cons = require('consolidate'); //view engine to html
var app = express();
app.set('port', process.env.PORT || 3000);
app.engine('html', cons.swig);
app.set('views', path.join(__dirname, 'pub'));
app.set('view engine', 'html');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
// app.use(express.static('./public'));
app.use(express.static(path.join(__dirname + '/pub')));
app.locals.theme = process.env.THEME; //Make the THEME environment variable available to the app.
// ---- App_Configuration -------------------------------
var config = fs.readFileSync('./app_config.json', 'utf8');
config = JSON.parse(config);
//-------------------------------------------------------
//---- AWS ----------------------------------------
// Create DynamoDB client and pass in region.
var db = new AWS.DynamoDB({region: config.AWS_REGION});
// Create SNS client and pass in region.
var sns = new AWS.SNS({ region: config.AWS_REGION});
// --------------------------------------------------
// ---- Server ------------------------------------
http.createServer(app).listen(app.get('port'), function(){
console.log('Express.js server listening on port ' + app.get('port'));
});
// ------------------------------------------------------
// ------- Routing -----------------------------------
app.get('/', routes.index); // GET home page.
app.get('/planet', routes.planet);
app.get('/brands', routes.brands);
app.get('/commitments', routes.commitments);
app.get('/people', routes.people);
app.get('/pwp', routes.pwp);
app.get('/perspectives', routes.perspectives);
app.get('/perspectives_dropdown', routes.perspectives_dropdown);
app.get('/products', routes.products);
app.get('/recipes', routes.recipes);
app.get('/governance', routes.governance);
app.get('/governance_dropdown', routes.governance_dropdown);
app.get('/governance_video', routes.governance_video);
app.get('/philanthropy', routes.philanthropy);
// app.get('/', routes.index);
// ----------------------------------------------------