Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serviceRouter is not accessible while subscribing for container #59

Open
kbarbounakis opened this issue Sep 28, 2022 · 0 comments
Open

Comments

@kbarbounakis
Copy link
Collaborator

Is your feature request related to a problem? Please describe.

ExpressDataApplication.container subscription giving access to application container but if you try to use getServiceRouter(Application) to get serviceRouter instance, it will be undefined.

import { getServiceRouter } from '@themost/data';
// create data application
const app = express();
....
const dataApplication = new ExpressDataApplication();
app.use(dataApplication.middleware(app));
...
dataApplication.container.subscribe((container) => {
    const router = getServiceRouter(container);
   // router is empty
});

Describe the solution you'd like
Provide a new subscription or event to handle serviceRouter instance e.g.

dataApplication.serviceRouter.subscribe((serviceRouter) => { ... });

or

import { AsyncSeriesEventEmitter } from '@themost/events';
dataApplication.serviceRouter = new AsyncSeriesEventEmitter();
dataApplication.serviceRouter.subscribe((serviceRouter) => { ... });
...
dataApplication.serviceRouter.emit(serviceRouter);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant