-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.ts
37 lines (33 loc) · 1.06 KB
/
index.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
import * as path from "path";
import { Logger } from "@rockerjs/common";
import { Application, AbstractApplication } from "@rockerjs/mvc";
@Application
export class App extends AbstractApplication{
public async beforeServerStart(server, args) {
Logger.info('beforeServerStart hook');
server.config({
assets: {
'/assets': {
folder: path.join(__dirname, 'assets'),
cache: 'Etag'
},
'/favicon.ico': {
folder: path.join(__dirname, 'assets')
}
},
errorProcessor: error => {
Logger.error("service error", error);
return {
status: {
code: error.code == undefined ? 1 : error.code,
message: error.message
}
};
}
});
}
public static async main(args) {
Logger.info('main bussiness ' + JSON.stringify(args));
// do some jobs
}
}