Todos

AutoApi

Simple Interactive Auto

A todo list that calls one interface, IDemoTodoService, from Interactive Server and from WebAssembly.

How it works

Try it: add, toggle and delete items, then reload. The first load runs on the server; once the WebAssembly runtime has downloaded, later loads run in the browser. The badge shows which one served the call.

  • IDemoTodoService is marked [RForgeAutoApi] in a shared library. This page only injects the interface.
  • On the server (prerendering and Interactive Server) the injected service is the real DemoTodoService. No HTTP request is made.
  • In WebAssembly the injected service is a class the generator wrote. It calls the generated endpoints with HttpClient.
  • A validation error is an RfException in both modes, so the one catch below works everywhere. Try adding an empty title, or more than 12 items.
  • The list is stored in server memory and shared by every visitor of this site. It holds 12 items, titles up to 60 characters, and goes back to its starting items every 30 minutes.

Todos

prerendering
An unhandled error has occurred. Reload 🗙