Skip to content

Commit

Permalink
feat: support first chance to define routes (#931) Thanks to @jsw-
Browse files Browse the repository at this point in the history
* feat: support first chance to define routes

* Empty commit to trigger a CI rerun
  • Loading branch information
jcw- authored Aug 4, 2020
1 parent 3f82832 commit 69fdebc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/cubejs-server/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import http from 'http';

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

declare class CubejsServer {
Expand Down
5 changes: 5 additions & 0 deletions packages/cubejs-server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class CubejsServer {
this.webSockets = config.webSockets;
this.redirector = null;
this.server = null;
this.initApp = config.initApp;
}

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

if (this.initApp) {
await this.initApp(app);
}

await this.core.initApp(app);

return new Promise((resolve, reject) => {
Expand Down

0 comments on commit 69fdebc

Please sign in to comment.