-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
45 lines (33 loc) · 981 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
35
36
37
38
39
40
41
42
43
44
45
var express = require('express');
var app = express();
/*==============================
PAGES
==============================*/
app.get('/', function(req, res) {
res.sendFile(__dirname + '/src/index.html')
});
app.get('/en', function(req, res) {
res.sendFile(__dirname + '/src/index_en.html')
});
app.get('/es', function(req, res) {
res.sendFile(__dirname + '/src/index_es.html')
});
/*==============================
Static Files
==============================*/
app.use(express.static(__dirname + '/src/assets'));
app.use((req, res, next) => {
res.status(404).redirect('/error/404')
});
// error handler middleware
app.use((error, req, res, next) => {
res.status(error.status || 500).send({
error: {
status: error.status || 500,
message: error.message || 'Internal Server Error',
},
});
});
app.listen(process.env.PORT || 5500, function() {
console.log('Running done!')
});