Skip to main content
The Feathers application is the main entry point for a Feathers server. It extends Node’s EventEmitter and provides methods for registering services, configuring the application, and managing the application lifecycle.

feathers()

Creates a new Feathers application instance.
object
Type definition for all services registered on the application
object
Type definition for application settings
Application<Services, Settings>
A new Feathers application instance

Properties

version

The Feathers version number.

services

An object containing all registered services keyed by their path.
Services should always be retrieved via app.service('name') not via app.services. Direct access to app.services is not recommended.

settings

An object containing all application settings that can be accessed via app.get() and app.set().

mixins

A list of callbacks that run when a new service is registered. Used internally for adding hooks and events functionality.

Methods

get()

Retrieve an application setting by name.
string
required
The setting name
any
The setting value, or undefined if not set

set()

Set an application setting.
string
required
The setting name
any
required
The setting value
Application
The application instance for chaining

configure()

Runs a callback configure function with the current application instance.
function
required
The callback (app: Application) => void to run. The callback is called with this bound to the app instance.
Application
The application instance for chaining

use()

Register a new service or a sub-app. When passed another Feathers application, all its services will be re-registered with the path prefix.
string
required
The path for the service to register (e.g., '/users', '/api')
ServiceInterface | Application
required
The service object to register or another Feathers application to use as a sub-app
ServiceOptions
Configuration options for this service
string[]
A list of service methods that should be available externally to clients
string[]
A list of custom events that this service emits to clients
string[]
Provide a full list of events that this service should emit. Unlike events, this will not be merged with the default events.
Application
The application instance for chaining

service()

Get the Feathers service instance for a path. This will be the service originally registered with Feathers functionality like hooks and events added.
string
required
The name of the service (e.g., 'users', '/api/messages')
FeathersService
The service instance with hooks and events

unuse()

Unregister an existing service. Calls teardown on the service if it exists.
string
required
The name of the service to unregister
Promise<FeathersService>
The unregistered service instance

setup()

Set up the application and call all services’ .setup() method if available.
any
A server instance (e.g., HTTP server)
Promise<Application>
The application instance

teardown()

Tear down the application and call all services’ .teardown() method if available.
any
A server instance (e.g., HTTP server)
Promise<Application>
The application instance

hooks()

Register application-level hooks that run for all services.
ApplicationHookOptions
required
The application hook settings
Application
The application instance for chaining
See the Hooks API for details on hook types and usage.

defaultService()

Returns a fallback service instance that will be registered when no service was found. Usually throws a NotFound error but also used to instantiate client-side services.
string
required
The path of the service
ServiceInterface
A fallback service instance

Events

The Feathers application extends Node’s EventEmitter, so you can use all EventEmitter methods:

Type Definitions