Endpoint
GET
/api/resultsDescription
Retrieves all race results from the database. Each result contains information about a driver’s position and points earned in a specific race.Request
This endpoint does not require any parameters or request body.Headers
No authentication or special headers required.Response
Array of result objects
Success response
Example request
Error responses
500 Internal Server Error
Returned when there is a database connection error or unexpected server issue.Implementation details
- Built with Nitro.js event handler
- Uses Prisma ORM to query the PostgreSQL database
- Returns all results without pagination
- No filtering or sorting applied by default
- Relations to
DriversandRacestables are available in the database schema but not populated in the response
Database schema
The Results table has the following structure:resultId: Primary key (auto-increment)raceId: Foreign key to Races table (nullable)driverId: Foreign key to Drivers table (nullable, VARCHAR 50)position: Integer (required)points: Integer (required)