Repository navigation
0.7.0
Resources and rate limits become values read as dependencies, so routes can be made and described before any database exists.
Upgrading
Spindle.Zod.module_→Spindle.Zod.schemas.Spindle_cli.runtakes the app itself and(), not a function ofenv:Spindle_cli.run ~name ~app:(Spindle.App.make routes) (). TheSpindle_cli.apptype is gone.Rate.createtakes no~mono_clock, so a limit is made at the top level:Spindle.Rate.create ~limit:10 ~per:Mtime.Span.min ().App.starttakes the monotonic clock as~mono_clock;Spindle.servegives it from its environment. A limit in an app never started answers500.- A limit's counts belong to its app, so two servers or two tests never share a key's count.
- In tests,
Test.app ~mono_clocktakes anEio_mockclock to move; by default the clock never moves.
New
- Resources:
let db = Dep.of_resource "database"names one,let+ pool = db inreads it in a route. Spindle.serve,App.startandTest.apptake~resources:[ Dep.resource db pool ].- A route reading a resource the server was not given, or one given twice, stops the server before it listens, naming both.
Test.appneeds only the resources the called routes read;Test.callraisesInvalid_argumenton a missing one.- The OpenAPI document and Zod schemas never list a resource.
Dep.needhas aResourceconstructor.