https://github.com/eros/ergast-node
Async Node.js wrapper for Ergast API
https://github.com/eros/ergast-node
ergast ergast-api f1 node nodejs typescript
Last synced: 3 months ago
JSON representation
Async Node.js wrapper for Ergast API
- Host: GitHub
- URL: https://github.com/eros/ergast-node
- Owner: Eros
- License: mit
- Created: 2023-04-08T18:22:32.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-01-10T14:57:35.000Z (over 1 year ago)
- Last Synced: 2025-02-08T15:16:55.707Z (3 months ago)
- Topics: ergast, ergast-api, f1, node, nodejs, typescript
- Language: TypeScript
- Homepage:
- Size: 78.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# Ergast Node
Small Async NodeJS wrapper for the Ergast API which provides data for the Formula 1 racing series.
See https://ergast.com/mrd/ for more information on their documentation.# Install
`npm install @rapidthenerd/ergast-ts`
[Npm link](https://www.npmjs.com/package/@rapidthenerd/ergast-ts?activeTab=readme)
# Setup
`npm install axios`
`npm intsall -D @types/node-cache`
> Minimum supported Node.js version is v14
# Usage
```typescript
import {ErgastNode} from "./ergastNode";class Example {
private readonly ergast: ErgastNode = new ErgastNode();
public exampleCircuit() {
this.ergast.circuit.getForCurrentYear(3);
this.ergast.circuit.getFor(2000, 3);
}
public exampleConstructor() {
this.ergast.constructor.getForTeam('red_bull');
}
public exampleDriver() {
this.ergast.driver.getByLastName('Tsunoda');
this.ergast.driver.getByDriverNumber(33);
}
public exampleFinishingStatus() {
this.ergast.finishingStatus.getFor(2000, 3);
this.ergast.finishingStatus.getForCurrentYear(3);
}
public exampleLaps() {
this.ergast.laps.getFor(2000, 2, 1);
this.ergast.laps.getForCurrentYear(2, 1);
}
public examplePitstops() {
this.ergast.pitStops.getFor(2000, 2, 1);
}
public exampleQualifying() {
this.ergast.qualifying.getFor(2000, 2);
}
public exampleSeasons() {
this.ergast.seasons.getForYear(2000);
this.ergast.seasons.getForCurrentYear();
}
public exampleStandings() {
this.ergast.standings.getFor(2000);
this.ergast.standings.getForCurrentYear();
}
}
```