forked from ethereum/ethereum-org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
121 lines (94 loc) · 2.58 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
const express = require('express');
const path = require('path');
const favicon = require('serve-favicon');
const bodyParser = require('body-parser');
// Init the app
const app = express();
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'pug');
app.use(favicon(path.join(__dirname, '/dist/images/favicon.png')));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(express.static(path.join(__dirname, 'dist')));
app.set('port', process.env.PORT || 8080);
// Routes
app.get('/', (request, response) => {
response.render('index');
});
app.get('/wallet', (request, response) => {
response.render('wallet');
});
app.get('/cli', (request, response) => {
response.render('cli');
});
app.get('/ether', (request, response) => {
response.render('ether');
});
app.get('/greeter', (request, response) => {
response.render('greeter');
});
app.get('/token', (request, response) => {
response.render('token');
});
app.get('/crowdsale', (request, response) => {
response.render('crowdsale');
});
app.get('/dao', (request, response) => {
response.render('dao');
});
app.get('/agreement', (request, response) => {
response.render('agreement');
});
app.get('/assets', (request, response) => {
response.render('assets');
});
app.get('/brand', (request, response) => {
response.render('brand');
});
app.get('/foundation', (request, response) => {
response.render('foundation');
});
app.get('/donate', (request, response) => {
response.render('donate');
});
app.get('/devgrants', (request, response) => {
response.render('devgrants');
});
app.get('/devcontwo', (request, response) => {
response.render('devcon2');
});
app.get('/swarm', (request, response) => {
response.render('swarm');
});
app.get('/privacy-policy', (request, response) => {
response.render('privacy-policy');
});
app.get('/cookie-policy', (request, response) => {
response.render('cookie-policy');
});
app.get('/terms-of-use', (request, response) => {
response.render('terms-of-use');
});
app.get('/*', (request, response, next) => {
let errStatus = 404;
// respond with html page
if (request.accepts('html')) {
response.render('404', { url: request.url });
return;
} else {
response.status(errStatus).end();
}
});
// error handlers
if (app.get('env') === 'development') {
// development error handler(Not needed for now)
app.use((err, request, response, next) => {
response.status(err.status || 500);
response.render('error', {
message: err.message,
error: err
});
});
}
module.exports = app;