diff --git a/examples/shape.mjs b/examples/shape.mjs new file mode 100644 index 0000000..dfda1c7 --- /dev/null +++ b/examples/shape.mjs @@ -0,0 +1,21 @@ +import onebusaway from '../dist/index.mjs'; +import { loadSettings } from './helpers/load-env.mjs'; + +// Load settings from .env file, if it exists. If not, we'll use the +// Puget Sound server URL (which is also the default in the SDK) and +// the 'TEST' API key. +const settings = loadSettings({ + apiKey: 'TEST', + baseUrl: 'https://api.pugetsound.onebusaway.org/', +}); + +// Create a new instance of the OneBusAway SDK with the settings we loaded. +const oba = new onebusaway(settings); + +async function main() { + const shapeId = '1_10002005'; + const response = await oba.shape.retrieve(shapeId); + console.log(response.data.entry.points[0]); +} + +main();