You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
763 B

10 years ago
var pkg = require('../package');
var markdown = require('markdown').markdown;
var fs = require('fs');
10 years ago
function setup(){
10 years ago
function controller( req, res, next ){
fs.readFile('./DOCS.md', 'utf8', function (err, content) {
if (!err) {
var header = '# Pelias API\n';
var version = '### Version: ['+ pkg.version+ '](https://github.com/pelias/api/releases)\n';
var style = '<style>html{font-family:monospace}</style>';
res.send(style + markdown.toHTML(header + version + content));
} else {
// stats
res.json({
name: pkg.name,
version: {
number: pkg.version
}
});
}
});
}
return controller;
10 years ago
10 years ago
}
module.exports = setup;