react-hono-with-react-router
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v83View latest version
This module provides SQLite storage for the Dish type using Valtown's SQLite functionality.
The dishes table has the following schema:
CREATE TABLE dishes (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
components TEXT NOT NULL
);
id: Unique identifier for the dish (UUID)name: Name of the dishcomponents: JSON string containing an array of component objects withidandnamefields
The migration runs automatically when the module is imported. It creates the table if it doesn't exist.
POST /api/dishes- Create or update a dishGET /api/dishes- Get all dishesGET /api/dishes/:id- Get a specific dish by IDDELETE /api/dishes/:id- Delete a dish by ID
{
id: "123e4567-e89b-12d3-a456-426614174000",
name: "Caesar Salad",
components: [
{ id: "comp-1", name: "Romaine Lettuce" },
{ id: "comp-2", name: "Parmesan Cheese" },
{ id: "comp-3", name: "Croutons" }
]
}
storeDish(dish: Dish)- Store a single dishstoreDishes(dishes: Dish[])- Bulk store multiple dishesgetDish(id: UUID)- Retrieve a dish by IDgetDishes(ids: UUID[])- Bulk retrieve dishes by IDsgetAllDishes()- Get all stored dishesdeleteDish(id: UUID)- Delete a dish by IDdeleteDishes(ids: UUID[])- Bulk delete dishes by IDsdishesExist(ids: UUID[])- Check if dishes exist by IDs
Components are stored as JSON strings in the database. This allows for flexible component structures while maintaining the relational database benefits for the main dish data.