Skip to content

Commit 6111f7c

Browse files
adding my experiments
1 parent 8d84f53 commit 6111f7c

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/file-read-manipulate.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const express = require('express')
2+
const app = express()
3+
const port = 3000
4+
5+
var fs = require('fs')
6+
var indexFile = fs.readFileSync('index.html', 'utf8');
7+
8+
app.get('/', (req, res) => {
9+
res.send('Hello World!' + indexFile)
10+
})
11+
12+
app.get('/greg', (req, res) => {
13+
var fenInjected = indexFile.replace("Boom",req.url);
14+
res.header('Cache-Control', 'private, no-cache, no-store, must-revalidate');
15+
res.header('Expires', '-1');
16+
res.header('Pragma', 'no-cache');
17+
res.send(fenInjected);
18+
})
19+
20+
21+
app.listen(port, () => {
22+
console.log(`Example app listening at http://localhost:${port}`)
23+
})
24+
25+
26+

0 commit comments

Comments
 (0)