nestjs-extras-w
v0.3.3
Published
_description_
Readme
nestjs-extras-w
Extra utilities for NestJS: HTTP listen with port fallback and graceful shutdown, microservice setup with env-expanded options, CORS and Swagger helpers, and BigInt/Decimal serialization fixes.
Usage
withNestjsListen— Start the app on a port (from env or default 3000), auto-try next port if in use, handle SIGINT and log microservice status.withNestjsMicroservice— Connect a microservice with options parsed throughdotenv-expand.withNestjsCors— Enable CORS with common defaults (methods, headers, credentials).withSwagger— Configure Swagger UI and JSON doc (e.g./swagger/website,/swagger/json).withDecimalRepair— Patch BigInt and DecimaltoJSON/toStringfor correct API serialization.
Re-exported context holds app instance, port, computed URL, and microservice/swagger config for use across these helpers.
Note for Developers
This starter recommands using npm Trusted Publisher, where the release is done on CI to ensure the security of the packages.
To do so, you need to run pnpm publish manually for the very first time to create the package on npm, and then go to https://www.npmjs.com/package/<your-package-name>/access to set the connection to your GitHub repo.
Then for the future releases, you can run pnpm run release to do the release and the GitHub Actions will take care of the release process.
