flashcard
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: v31View latest version
This directory contains the server-side code for the Flashcard Learning App.
- index.ts - Main Hono app setup, route mounting, and static file serving
- storage.ts - Blob storage utilities for user data persistence
- routes/ - API endpoint implementations
- Handles user login and initialization
- Creates new user data if doesn't exist
- CRUD operations for flashcard decks
- Cascade deletion of cards when deck is deleted
- CRUD operations for flashcards
- Validates deck existence before card creation
- Fetches due cards based on spaced repetition
- Processes card reviews and updates SM-2 parameters
- Retrieves user statistics
- Saves completed study sessions
- Exports user data as JSON
- Imports user data from JSON backup
All routes (except login) require X-Username header for user identification.
Hono's onError is configured to throw errors for full stack traces.
- Load user data from blob storage
- Perform in-memory operations
- Save back to blob storage
- Create new file in
routes/ - Export a Hono instance
- Mount in
index.tswithapp.route() - Add
X-Usernameheader check if needed