Durable Objects · Exercise 03

Store data with SQL

Give a second Durable Object class its own SQLite database, store messages in it with SQL, and see that every object's database is separate.

Store data with SQL

The counter stored one number. Real apps store rows: messages, orders, edits to a document. Every SQLite-backed Durable Object comes with its own SQL database, right next to its code.

What you’ll build

A second Durable Object class, Room, that stores chat messages in a messages table with SQL, and a /room route to post and read them. Each room name gets its own database.

Prerequisites