puerto 0.23.0

Puerto — Rust full-stack DDD framework CLI. Scaffolds Clean Architecture projects with auto-wired DI, SQLx support, and zero manual wiring. Formerly puerto-framework.
1
2
3
4
5
6
7
8
9
10
11
12
13
import createClient, { type Client, type ClientOptions } from "openapi-fetch";
import type { components, paths } from "./esquema";

/** El cliente tipado de la API. `paths` sale de la especificación del backend (`make web/sync`). */
export type ClienteApi = Client<paths>;

/** Los DTO de la API por nombre: `Esquemas["DtoProducto"]`, `Esquemas["PeticionCrearProducto"]`. */
export type Esquemas = components["schemas"];

/** `/api` es el backend: en desarrollo, Vite lo pasa a `:8080`. */
export function crearClienteApi(opciones: ClientOptions = {}): ClienteApi {
  return createClient<paths>({ baseUrl: "/api", ...opciones });
}