1 | import * as Koa from 'koa';
|
2 | import { Loader } from './loader';
|
3 | import logger from './logger';
|
4 | import { Controller } from './base/controller';
|
5 | import { Service } from './base/service';
|
6 |
|
7 |
|
8 | export interface KV {
|
9 | [key: string]: any
|
10 | }
|
11 |
|
12 | export class Burn extends Koa {
|
13 | private loader: Loader;
|
14 | private port: number;
|
15 | private ip: string;
|
16 | static Controller: typeof Controller = Controller;
|
17 | static Service: typeof Service = Service;
|
18 |
|
19 | config: KV = {};
|
20 |
|
21 | constructor() {
|
22 | super();
|
23 | this.loader = new Loader(this);
|
24 | this.port = 3000;
|
25 | this.ip = '127.0.0.1';
|
26 | }
|
27 |
|
28 | run() {
|
29 | this.loader.load();
|
30 | this.listen(this.port, this.ip, () => {
|
31 | logger.green(`Burn服务器运行在:${this.ip}:${this.port}`)
|
32 | })
|
33 | }
|
34 | } |
\ | No newline at end of file |