mirror of https://github.com/pelias/api.git
Diana Shkolnikov
9 years ago
7 changed files with 54 additions and 49 deletions
@ -1,31 +0,0 @@
|
||||
|
||||
var pkg = require('../package'); |
||||
var markdown = require('markdown').markdown; |
||||
var fs = require('fs'); |
||||
|
||||
function setup(){ |
||||
|
||||
var styleString = '<style>html{font-family:monospace}</style>'; |
||||
var text = '# Pelias API\n'; |
||||
text += '### Version: ['+ pkg.version+ '](https://github.com/pelias/api/releases)\n'; |
||||
text += fs.readFileSync( './DOCS.md', 'utf8'); |
||||
var indexHtml = styleString + markdown.toHTML(text); |
||||
|
||||
function controller( req, res, next ) { |
||||
if (req.accepts('html')) { |
||||
res.send(indexHtml); |
||||
return; |
||||
} |
||||
// default behaviour
|
||||
res.json({ |
||||
name: pkg.name, |
||||
version: { |
||||
number: pkg.version |
||||
} |
||||
}); |
||||
} |
||||
|
||||
return controller; |
||||
} |
||||
|
||||
module.exports = setup; |
@ -0,0 +1,28 @@
|
||||
|
||||
var markdown = require('markdown').markdown; |
||||
var fs = require('fs'); |
||||
|
||||
function setup(peliasConfig, markdownFile){ |
||||
|
||||
var styleString = '<style>html{font-family:monospace}</style>'; |
||||
var text = '# Pelias API\n'; |
||||
text += '### Version: [' + peliasConfig.version + '](https://github.com/pelias/api/releases)\n'; |
||||
text += fs.readFileSync( markdownFile, 'utf8'); |
||||
var html = styleString + markdown.toHTML(text); |
||||
|
||||
function controller( req, res ) { |
||||
if (req.accepts('html')) { |
||||
res.send(html); |
||||
return; |
||||
} |
||||
// default behaviour
|
||||
res.json({ |
||||
markdown: text, |
||||
html: html |
||||
}); |
||||
} |
||||
|
||||
return controller; |
||||
} |
||||
|
||||
module.exports = setup; |
@ -0,0 +1,7 @@
|
||||
## Attribution |
||||
* Geocoding by [Pelias](https://mapzen.com/pelias) from [Mapzen](https://mapzen.com) |
||||
* Data from |
||||
* [OpenStreetMap](http://www.openstreetmap.org/copyright) © OpenStreetMap contributors under [ODbL](http://opendatacommons.org/licenses/odbl/) |
||||
* [Quattroshapes](https://github.com/foursquare/quattroshapes/blob/master/LICENSE.md) under [CC-BY-2.0](https://creativecommons.org/licenses/by/2.0/) |
||||
* [GeoNames](http://www.geonames.org/) under [CC-BY-3.0](https://creativecommons.org/licenses/by/2.0/) |
||||
* and other sources |
Loading…
Reference in new issue