Change endpoint URLs (close #154)

- styles at /style/{id}/style.json
- rendered tiles at /style/{id}/{z}/{x}/{y}.{format}
- TileJSONs at /style/{id}.json
This commit is contained in:
Petr Sloup
2017-06-22 16:36:08 +02:00
parent 8007f1386c
commit 698c527e94
9 changed files with 26 additions and 26 deletions

View File

@@ -71,6 +71,6 @@ describe('Metadata', function() {
});
});
testTileJSON('/styles/test-style/rendered.json');
testTileJSON('/styles/test-style.json');
testTileJSON('/data/openmaptiles.json');
});

View File

@@ -11,12 +11,12 @@ var testIs = function(url, type, status) {
var prefix = 'test-style';
describe('Styles', function() {
describe('/styles/' + prefix + '.json is valid style', function() {
testIs('/styles/' + prefix + '.json', /application\/json/);
describe('/styles/' + prefix + '/style.json is valid style', function() {
testIs('/styles/' + prefix + '/style.json', /application\/json/);
it('contains expected properties', function(done) {
supertest(app)
.get('/styles/' + prefix + '.json')
.get('/styles/' + prefix + '/style.json')
.expect(function(res) {
res.body.version.should.equal(8);
res.body.name.should.be.String();
@@ -27,8 +27,8 @@ describe('Styles', function() {
}).end(done);
});
});
describe('/styles/streets.json is not served', function() {
testIs('/styles/streets.json', /./, 404);
describe('/styles/streets/style.json is not served', function() {
testIs('/styles/streets/style.json', /./, 404);
});
describe('/styles/' + prefix + '/sprite[@2x].{format}', function() {

View File

@@ -1,6 +1,6 @@
var testTile = function(prefix, z, x, y, format, status, scale, type) {
if (scale) y += '@' + scale + 'x';
var path = '/styles/' + prefix + '/rendered/' + z + '/' + x + '/' + y + '.' + format;
var path = '/styles/' + prefix + '/' + z + '/' + x + '/' + y + '.' + format;
it(path + ' returns ' + status, function(done) {
var test = supertest(app).get(path);
test.expect(status);