-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add example for retrieving shape information
- Loading branch information
1 parent
bfe5e3e
commit 8d6ddac
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); |