feathers-async-boot
Booting FeathersJS asynchron.
About
Starting the application after all required tasks are done. For example you have to fill your memory storage with content before the application should start the http server.
Installation
npm install --save feathers-async-boot
Usage
-
create a module which should do you asynchron task. This module must return a Promise
-
register the async bootstrap module
-
configure the async bootstrap
-
Call
app.start()
. This will return a Promise.Example:
const app = ;...app;app;appstart;
Configuration
Error handling
There are different posibilities to start your application, even on when your bootstrap modules are rejected.
ABORT
- with finally (using finally Node.js >= 10 is required)
const app = ; app start ;
- or on rejection (using Node.js < 10)
const app = ; app start ;
WARN
The start will always resolve, as a result you get all possible errors
const app = ; const ErrorHandling = ; app startErrorHandlingWARN ;
IGNORE
The start will always resolve, result will be always true
const app = ; const ErrorHandling = ; app startErrorHandlingWARN ;
Example
const feathers = ;const express = ;const boot = ; const asyncModuleToBoot = ; const app = ; app; app;app;app; app start ;
for more examples see the example directory.