Essentials
Application & bootstrap
Every Stone.js app has one manifest: a class marked with @StoneApp (or a defineStoneApp value). It names the app, lists the adapters that give it a context, and sets app-wide options. It is the only file that knows about platforms.
#Declaring the app
The manifest carries no logic of its own. Adapters and blueprints stack on it as decorators (or as an array, imperatively); options go to @StoneApp.
import { StoneApp } from '@stone-js/core'
import { Routing } from '@stone-js/router'
import { NodeHttp } from '@stone-js/node-http-adapter'
@NodeHttp()
@Routing()
@StoneApp({
name: 'tasks',
logger: { level: 'info' }
})
export class Application {}import { defineStoneApp } from '@stone-js/core'
import { routerBlueprint } from '@stone-js/router'
import { nodeHttpAdapterBlueprint } from '@stone-js/node-http-adapter'
export const App = defineStoneApp(
{ name: 'tasks', logger: { level: 'info' } },
[routerBlueprint, nodeHttpAdapterBlueprint]
)#App options
| Option | Type | Default | Description |
|---|---|---|---|
| name | string | · | The application name, used in logs and tooling. |
| logger | { level, ... } | { level: 'info' } | Logger configuration (see Logging). |
| debug | boolean | false | Verbose diagnostics and richer error output. |
| middleware | MixedPipe[] | · | Global middleware for every event. |
| providers | MixedServiceProvider[] | · | Service providers to register. |
#One handler, or a router
A minimal app can implement a single handler right on the manifest. The moment you need more than one entry point, add @Routing() and delegate to controllers, which is what most apps do.