LibraryActive

AdonisJS Application

Root Application class that wires together an AdonisJS app, exposing environment, state, signals, and path helpers.

Open source page ↗

Product features

Product features

Add your first action

Connect the controller to a route

Constructor injection

Controllers

Creating your first controller

Dependency injection

Generate the controller

getEnvironment

Returns the current runtime environment: web, console, repl, or test.

listen / listenOnce

Register POSIX signal listeners on the Node.js process object.

Method injection

nodeEnvironment

Exposes the Node.js environment derived from NODE_ENV, normalized for consistency.

notify

Sends messages to the parent process by wrapping process.send.

Resource-driven controllers

setEnvironment

Switches the application environment before the app has been booted.

getState

Returns lifecycle state: created, initiated, booted, ready, or terminated.

Test it out

The barrel file

Understanding controller lifecycle