The Scenario
The library approved your API, but now they need real data persistence. They also want to track "Authors" separately from "Books". You need to connect a database, define the schema, and update the API to perform relational queries.
The Brief
Integrate a PostgreSQL or SQLite database using an ORM like Prisma or Drizzle (or raw SQL). 1) Define the schema for `Author` (1-to-many) `Book`. 2) Write the logic to fetch a list of all books, including the author name in the response (a JOIN operation). 3) Write the logic to create a new book associated with an existing author.
Deliverables
- The schema definition file (e.g., `schema.prisma` or SQL migration file)
- The updated GET route containing the relational query (JOIN)
- The updated POST route demonstrating how to insert relational data safely
Submission Guidance
You do not need to host the database. Submit the code for the schema and the specific ORM/SQL queries you use to satisfy the relational requirements.
Submit Your Work
Your submission is graded against the rubric on the right. If you pass, you get a public Badge URL you can share on LinkedIn. There is no draft save, so work offline first and paste your finished response here.