Open GrahamHotchkiss opened 1 year ago
@MikeCoats - so I see this is a deliberate choice https://github.com/Scottish-Natural-Heritage/sitelink-api-mirror/blob/136378d9607d8f1bfac6fbccf43aa6eab86a13dd/mirror.mjs#L158-L160 + https://github.com/Scottish-Natural-Heritage/sitelink-api-mirror/blob/136378d9607d8f1bfac6fbccf43aa6eab86a13dd/mirror.mjs#L205-L206
Looks like it is trying to create a relative path but not seeing anything in the blaim history to enlighten me any further.
It allows you to host locally or in any cloud environment without having to think about the domain you're serving from.
http://localhost:8080/sitelink-api/v1/sites/1
http://naturescot-sitelink-mirror.s3-website.eu-west-2.amazonaws.com/sitelink-api/v1/sites/1
https://d3ovo1aozvg78c.cloudfront.net/sitelink-api/v1/sites/1
https://sitelink-api.nature.scot/sitelink-api/v1/sites/1
By using just /sitelink-api/v1/sites/1
you get away from trying to be too clever or baking in an artefact of how you deploy the mirror.
But the application actually uses the 'url' as a URL, we published it as such and this is a material change from the original.
Reads
"url": "/sitelink-api/v1/sites/1"
rather than"url": ""https://apps.snh.gov.uk/sitelink-api/v1/sites/1"