Usage examples
TransportAPI usage examples show how our endpoints can be used. They are intended for a technical audience, to provide inspiration for what can be built, and tutorials to get started, with code that can be reused in applications. The examples are mini web applications, written in HTML and javascript. They focus on processing data from the API, rather than style: we don't want functional code getting lost in a sea of styling.
Development
- Install the required packages
npm ci
- Build the project from the project root directory
npm run build
- Serve (automatically refreshes on code changes)
npm run serve
- Open
http://localhost:1234/?localDevelopment=true&branch=<YOUR DEVELOPMENT BRANCH>
Reviewing examples
By using the local setup
- Run the usage examples locally (See Development)
- Open
http://localhost:1234/?localDevelopment=true&branch=<REVIEWED BRANCH>
By using experimental examples in production
The usage examples navigation page supports experimental usage examples
to perform production quality inspection without affecting the user experience.
The examples that are marked as experimental won't be shown unless an
additional request parameter showExperimental=true
is provided.
Example: https://developer.transportapi.com/examples?showExperimental=true
To mark example as experimental add experimental: true
to the listed
examples
in main.js