Scottish-Natural-Heritage / sitelink-api-mirror

Static mirror for NatureScot's Sitelink API
Other
0 stars 0 forks source link

Scraped url missing the protocol and domain #3

Open GrahamHotchkiss opened 1 year ago

GrahamHotchkiss commented 1 year ago

Reads "url": "/sitelink-api/v1/sites/1" rather than "url": ""https://apps.snh.gov.uk/sitelink-api/v1/sites/1"

GrahamHotchkiss commented 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.

MikeCoats commented 1 year ago

It allows you to host locally or in any cloud environment without having to think about the domain you're serving from.

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.

GrahamHotchkiss commented 1 year ago

But the application actually uses the 'url' as a URL, we published it as such and this is a material change from the original.