-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
35 lines (25 loc) · 811 Bytes
/
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
const express = require("express")
var compression = require("compression")
const fs = require("fs")
/* Start server here */
const app = express();
// Use compression
app.use(compression());
// enable ejs
app.set('view engine', 'ejs')
// resources directory for images and such
// bootstrap css file
app.use(express.static(__dirname + '/resources'));
app.use("/projects", express.static(__dirname + '/projects'));
app.use("/rss", express.static(__dirname + '/rss'));
// read in the metadata file to display the blog posts
var metadata = JSON.parse(fs.readFileSync('./blogmetadata.json', 'utf8'));
app.get('/', (req, res) => {
res.render('index', {
metadata: metadata
})
});
const PORT = 8080
app.listen(PORT, () => {
console.log(`Server started on http://localhost:${PORT}`)
});