-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
43 lines (35 loc) · 1.11 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
var express = require("express");
var yaml = require('js-yaml');
var fs = require('fs');
var url = require('url');
function loadYamlData(filename) {
return yaml.load(
fs.readFileSync(__dirname + '/data/' + filename, 'utf8'),
{filename: filename});
}
var resume = require('./lib/resume.js');
var profiles = loadYamlData('profiles.yaml');
module.exports = function appctor(cfg){
var app = express();
app.use(express.static(__dirname+'/static'));
app.get('/resume', resume.html);
app.get('/resume.html', resume.html);
app.get('/resume.md', resume.md);
app.get('/resume.markdown', resume.md);
app.get('/resume.txt', resume.md);
app.get('/resume.yaml', resume.yaml);
app.get('/profiles', function(req,res) {
function favicon(pageUrl) {
return "https://www.google.com/s2/favicons?domain=" +
url.parse(pageUrl).hostname;
}
res.render('profiles.pug', {profiles: profiles, favicon: favicon});
});
app.get('/specs', function(req,res) {
res.render('specs.pug');
});
app.get('/info', function(req, res) {
res.redirect('/specs');
});
return app;
};