-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
54 lines (47 loc) · 1.33 KB
/
index.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
const express = require('express');
const path = require('path');
const fs = require('fs');
const app = express();
const port = 4000;
app.use('/static', express.static(__dirname + '/static'))
app.set('views', path.join(__dirname, 'views'));
app.get('/', (req, res) => {
// console.log(__dirname);
console.log(path.join(__dirname, 'views'));
fs.readFile('views/index.html', 'utf8', function(err, data) {
if (err)
console.log(err);
else
res.send(data)
});
})
app.get('/chat', (req, res) => {
fs.readFile('views/chat.html', 'utf8', function(err, data) {
if (err)
console.log(err);
else
// params = {};
// res.status(200).render('views/chat.html', params);
res.send(data)
});
})
app.get('/docker', (req, res) => {
fs.readFile('./views/docker.html', 'utf8', function(err, data) {
if (err)
console.log(err);
else
// res.status(200).render('index.html', params);
res.send(data);
});
});
app.get('/test', (req, res) => {
fs.readFile('views/test.html', 'utf8', function(err, data) {
if (err)
console.log(err);
else
res.send(data);
});
});
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`);
})