ExampleServer overview
The ExampleServer.make
function generates a RouterBuilder
implementation based on an instance of Api
. The listening server will perform all the request and response validations similarly to a real implementation.
Responses returned from the server are generated randomly using the response Schema
.
Added in v1.0.0
Table of contents
utils
handle
Create an example implementation for a single endpoint.
Signature
export declare const handle: <A extends ApiEndpoint.ApiEndpoint.Any, Id extends ApiEndpoint.ApiEndpoint.Id<A>>(
id: Id
) => <R, E>(
routerBuilder: RouterBuilder.RouterBuilder<A, E, R>
) => RouterBuilder.RouterBuilder<
ApiEndpoint.ApiEndpoint.ExcludeById<A, Id>,
E,
R | ApiEndpoint.ApiEndpoint.Context<ApiEndpoint.ApiEndpoint.ExtractById<A, Id>>
>
Added in v1.0.0
handleRemaining
Create an example implementation for all remaining endpoints.
Signature
export declare const handleRemaining: <A extends ApiEndpoint.ApiEndpoint.Any, E, R>(
routerBuilder: RouterBuilder.RouterBuilder<A, E, R>
) => RouterBuilder.RouterBuilder<never, E, R | ApiEndpoint.ApiEndpoint.Context<A>>
Added in v1.0.0
make
Generate an example RouterBuilder
implementation.
Signature
export declare const make: <A extends Api.Api.Any>(
api: A
) => RouterBuilder.RouterBuilder<Api.Api.Context<A>, never, never>
Added in v1.0.0
makeSchema
Generate an example value for the given schema.
Signature
export declare const makeSchema: <A, Encoded, R>(schema: Schema.Schema<A, Encoded, R>) => Effect.Effect<A>
Added in v1.0.0