Test Repo for Api Features Client
Ensure docker is installed.
$ sudo docker pull geopython/pygeoapi
$ sudo docker run -p 5000:80 geopython/pygeoapi # Alternative: pnpm dockerNow the API is running on http://localhost:5000
Have NodeJS & NPM installed. Clone the repo.
$ cd test-api-features-client
$ npm i -g pnpm
$ pnpm install
import ogc from "<path-to-src-folder>";(async() => {
await ogc.get() // Route: /, Method: GET
await ogc.conformance().get(); // Route: /conformance, Method: GET
await ogc.collections().get(); // Route: /collections, Method: GET
await ogc.collection("collection_id").get(); // Route: /collections/collection_id, Method: GET
await ogc.collection("collection_id").items().get(); // Route: /collections/collection_id/items, Method: GET
await ogc.collection("collection_id").item("feature_id").get(); // Route : /collections/collection_id/items/feature_id, Method: GET
})();in accordance to the OGC Features API v1.0.1
import ogc from "../src";
(async() => {
const res = await ogc.collections().get();
if(res.status === 200) {
console.log(res.data.links[0].href);
} else {
console.log(res.data.code);
}
})()Make sure API is running and then
$ pnpm test$ pnpm build