Skip to content

Commit 69fdebc

Browse files
authored
feat: support first chance to define routes (#931) Thanks to @jsw-
* feat: support first chance to define routes * Empty commit to trigger a CI rerun
1 parent 3f82832 commit 69fdebc

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

packages/cubejs-server/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import http from 'http';
55

66
export interface CreateOptions extends CoreCreateOptions {
77
webSockets?: boolean;
8+
initApp?(app: express.Application): void | Promise<void>;
89
}
910

1011
declare class CubejsServer {

packages/cubejs-server/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class CubejsServer {
1212
this.webSockets = config.webSockets;
1313
this.redirector = null;
1414
this.server = null;
15+
this.initApp = config.initApp;
1516
}
1617

1718
async listen(options = {}) {
@@ -29,6 +30,10 @@ class CubejsServer {
2930
app.use(require("cors")());
3031
app.use(bodyParser.json({ limit: "50mb" }));
3132

33+
if (this.initApp) {
34+
await this.initApp(app);
35+
}
36+
3237
await this.core.initApp(app);
3338

3439
return new Promise((resolve, reject) => {

0 commit comments

Comments
 (0)