Check
expressots check answers one question: would this application start? It runs the project's entry point the way expressots dev does, lets the framework build the container and resolve every controller with its dependencies, and exits before it would listen.
No port is opened, so it is safe next to a running dev server, and it is quick enough for a pre-commit hook or a CI step. Available since 4.4.0.
expressots check
Check passed: 4 controllers, 11 routes and 9 providers resolved. No port was opened.
When something cannot be resolved, the framework's own error is printed, with what to change:
No matching bindings found for serviceIdentifier: Mailer
Requested by: MailController (constructor argument 0)
Fix: add @provide(Mailer) to the Mailer class, or bind it in a module. If it already has @provide, make sure its file is imported before the application starts.
Code: EXP1001
The code at the end has its own page: see Framework codes.
Exit status
| Status | Meaning |
|---|---|
0 | The application would start. |
1 | It would not, or the check could not be run or timed out. |
Options
| Option | Default | What it does |
|---|---|---|
--json | off | Print the result as one JSON object and nothing else. |
--timeout <n> | 60 | Seconds to wait for the application. A check that runs out of time stops the application and fails. |
--runtime, -r | auto | node or bun. Bun is chosen when the project uses it and it is installed. EXPRESSOTS_RUNTIME also sets it. |
JSON output
With --json the only thing written to standard output is the result.
expressots check --json
{ "ok": true, "controllers": 4, "routes": 11, "providers": 9, "durationMs": 412 }
A failure carries the framework's error in parts:
{
"ok": false,
"error": {
"name": "FrameworkError",
"code": "EXP1001",
"summary": "No matching bindings found for serviceIdentifier: Mailer",
"requestedBy": "MailController (constructor argument 0)",
"fix": "add @provide(Mailer) to the Mailer class, or bind it in a module. If it already has @provide, make sure its file is imported before the application starts.",
"message": "No matching bindings found for serviceIdentifier: Mailer\n Requested by: MailController (constructor argument 0)\n Fix: ...\n Code: EXP1001"
}
}
What runs and what does not
A check run goes through the application's start: globalConfiguration(), configureServices() and the building of the container all run, so a mistake in any of them is found. postServerInitialization() does not run, because the server never listens.
Code that runs when the entry file is imported also runs. If the application connects to a database at import time, the check does too.
Applications built with micro() or createMicroAPI() are supported: their routes are registered and the check stops before the port.
Requirements
The project needs @expressots/core and @expressots/adapter-express 4.4.0 or later. On an older version the command says so and exits with status 1.