-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
40 lines (28 loc) · 954 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
'use strict'
/*
Use node.js, express and prerender.io
to this website can be crawled
by search engines like Google
======================================
*/
const express = require('express')
const fs = require('fs')
// Set express
const app = express()
const markdown = require('markdown').markdown
const config = require('./config/global.config')
// Active prerender.io
app.use( require('prerender-node') )
// On home, send metas and resume
app.get('/', function (req, res) {
const sResumePath = __dirname + '/content/RESUME.md'
const sContent = fs.readFileSync(sResumePath, 'utf8');
let sHTML = markdown.toHTML( sContent )
if( config.TITLE_TAG !== undefined && config.DESCRIPTION_TAG !== undefined ) {
sHTML = `${config.TITLE_TAG} ${config.DESCRIPTION_TAG} ${sHTML}`
}
res.send( sHTML );
})
app.listen(3000, function () {
console.log('Running on port 3000!');
});