Ignitor class is the main entry point for creating and managing AdonisJS application processes. It is used to instantiate an AdonisJS application in different known environments such as web servers, console commands, and test runners.
Import
Constructor
Creates a new Ignitor instance.The root URL of the application. Typically created using
new URL(import.meta.url).Configuration options for the ignitor.
Methods
createApp
Creates an instance of the AdonisJS application for a specific environment.The environment in which to create the app. Valid values are:
'web'- For HTTP server processes'console'- For Ace CLI commands'test'- For test runner processes'repl'- For REPL sessions
Returns an instance of the Application class with all container bindings registered.
getApp
Retrieve the application instance created by the ignitor.Returns the application instance if it has been created, otherwise
undefined.tap
Register a callback to access the application instance immediately after it is created.Callback function that receives the application instance. Can be synchronous or asynchronous.
Returns the Ignitor instance for method chaining.
httpServer
Get an instance of the HTTP server process for running web applications.Returns a new
HttpServerProcess instance that can be used to start the HTTP server.ace
Get an instance of the Ace process for running CLI commands.Returns a new
AceProcess instance that can be used to handle command line arguments.testRunner
Get an instance of the test runner process for running tests.Returns a new
TestRunnerProcess instance that can be used to run test suites.terminate
Terminates the application by calling theapp.terminate() method.
Returns a promise that resolves when the application has been terminated.
Usage Examples
Starting an HTTP Server
Running CLI Commands
Running Tests
Using tap for Configuration
Process Classes
HttpServerProcess
The HTTP server process manages the Node.js HTTP server lifecycle.start
Starts the HTTP server and wires up the application.Optional callback to create a custom HTTP server instance. Useful for HTTPS or custom server configurations.
AceProcess
The Ace process manages CLI command execution.configure
Register a callback to configure the Ace kernel before handling commands.Configuration callback function.
handle
Handles command line arguments and executes matching Ace commands.Command line arguments array, typically
process.argv.slice(2).TestRunnerProcess
The test runner process manages the test environment lifecycle.configure
Register a callback that runs after booting the app and before the provider’s ready hook.Configuration callback function.
run
Runs a callback after starting the app.Test execution callback function.