-
Notifications
You must be signed in to change notification settings - Fork 29
/
index.d.ts
37 lines (31 loc) · 806 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/// <reference types="node" />
import {EventEmitter} from 'events'
interface Log {
body: any
ip: string
method: string
url: string
query: any
params: any
}
declare interface Options {
protocol?: string
domain?: string
port?: number
cache?: string
watch?: boolean
}
interface Server extends EventEmitter {
// Operations
start(options: Options): Promise<Options>;
restart(options: Options): Promise<Options>;
close(): Promise<void>;
// Listeners
on(type: 'start', callback: (options: Options) => void): this;
on(type: 'end', callback: () => void): this;
on(type: 'log', callback: (log: Log) => void): this;
on(type: 'error', callback: (error: Error) => void): this;
}
declare function server(options?: Options): Server
declare namespace server {}
export = server