modular_api 0.0.4
modular_api: ^0.0.4 copied to clipboard
Use case centric API toolkit for Shelf UseCase base class, HTTP adapters, CORS/API-Key middlewares, and OpenAPI specifications.
Changelog #
0.0.4 - 2025-10-23 #
Changed #
Envbehavior: when a.envfile is not found the library reads values fromPlatform.environment. If a requested key is missing from both sources anEnvKeyNotFoundExceptionis thrown.
0.0.3 - 2025-10-23 #
Added #
- Automatic health endpoint: the server registers
GET /healthwhich responds withokon startup. Implemented inmodular_api.dart(exposes_root.get('/health', (Request request) => Response.ok('ok'));).
All notable changes to this project will be documented in this file.
The format loosely follows Keep a Changelog and the project adheres to Semantic Versioning.
0.0.2 - 2025-10-21 #
Changed #
- refactor: improve OpenAPI initialization (now initialized automatically internally)
- Rename middlewares as examples
- rename example project to template
- Add a simple example
0.0.1 - 2025-10-21 #
Added #
- Initial release of modular_api. Main features:
- Use-case centric framework with
UseCase<I extends Input, O extends Output>base classes and DTO helpers (Input/Output). - HTTP adapter
useCaseHttpHandler()to expose UseCases as ShelfHandlers. - Built-in middlewares:
cors()andapiKey()for CORS handling and header-based API key authentication. - OpenAPI/Swagger generation helpers (
OpenApi.init,OpenApi.docs) that infer schemas from DTOtoSchema(). - Utilities:
Env.getString,Env.getInt,Env.setString(.env support via dotenv) andgetLocalIp. - Minimal ODBC
DbClient(DSN-based) exported for database access; example factories and usage provided inexample/(tested with Oracle and SQL Server; seeNOTICEfor provenance). - Example project demonstrating modules and usecases under
example/and unit-test helpers (useCaseTestHandler) undertest/. - Public API exports in
lib/modular_api.dartfor easy consumption.
- Use-case centric framework with