101 lines
1.5 KiB
Markdown
101 lines
1.5 KiB
Markdown
[**flummpress**](../README.md)
|
|
|
|
***
|
|
|
|
[flummpress](../README.md) / default
|
|
|
|
# Class: default
|
|
|
|
Defined in: index.ts:12
|
|
|
|
## Constructors
|
|
|
|
### new default()
|
|
|
|
> **new default**(): `Flummpress`
|
|
|
|
Defined in: index.ts:18
|
|
|
|
#### Returns
|
|
|
|
`Flummpress`
|
|
|
|
## Properties
|
|
|
|
### middleware
|
|
|
|
> **middleware**: `Handler`[]
|
|
|
|
Defined in: index.ts:16
|
|
|
|
***
|
|
|
|
### router
|
|
|
|
> **router**: [`Router`](Router.md)
|
|
|
|
Defined in: index.ts:14
|
|
|
|
***
|
|
|
|
### tpl
|
|
|
|
> **tpl**: [`Tpl`](Tpl.md)
|
|
|
|
Defined in: index.ts:15
|
|
|
|
## Methods
|
|
|
|
### listen()
|
|
|
|
> **listen**(...`args`): `this`
|
|
|
|
Defined in: index.ts:80
|
|
|
|
Starts the HTTP server and begins listening for incoming requests.
|
|
|
|
#### Parameters
|
|
|
|
##### args
|
|
|
|
...`any`[]
|
|
|
|
Arguments passed to `http.Server.listen`.
|
|
|
|
#### Returns
|
|
|
|
`this`
|
|
|
|
- The current instance for chaining.
|
|
|
|
***
|
|
|
|
### use()
|
|
|
|
> **use**(`plugin`): `this`
|
|
|
|
Defined in: index.ts:37
|
|
|
|
Adds a plugin to the application, which can be a Router instance, Tpl instance,
|
|
or a middleware handler function. The method determines the type of the plugin
|
|
and performs the appropriate action.
|
|
|
|
- If the plugin is an instance of `Router`, it is added to the application's router.
|
|
- If the plugin is an instance of `Tpl`, it sets the application's template engine.
|
|
- If the plugin is a middleware function, it is added to the middleware stack.
|
|
|
|
#### Parameters
|
|
|
|
##### plugin
|
|
|
|
The plugin to add, which can be a `Router` instance,
|
|
a `Tpl` instance, or a middleware handler function.
|
|
|
|
[`Tpl`](Tpl.md) | [`Router`](Router.md) | `Handler`
|
|
|
|
#### Returns
|
|
|
|
`this`
|
|
|
|
The current instance for method chaining.
|