/usr/share/doc/node-tilelive/examples/server.js is in node-tilelive 4.5.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | // Tile server using the node web framework Express (http://expressjs.com).
var app = require('express').createServer(),
mapnik = require('tilelive-mapnik'),
tilelive = new (require('tilelive').Server)(mapnik);
app.get('/:z/:x/:y.*', function(req, res) {
var options = {
x: req.param('x'),
y: req.param('y'),
z: req.param('z'),
format: req.params[0],
datasource: __dirname + '/stylesheet.xml'
};
tilelive.serve(options, function(err, data) {
if (!err) {
res.send.apply(res, data);
} else {
res.send('Tile rendering error: ' + err + '\n');
}
});
});
console.log('Listening on port: ' + 8888);
app.listen(8888);
|