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

Sugar API for registering services + automated registration via boot #1439

Closed
8 tasks done
bajtos opened this issue Jun 19, 2018 · 1 comment
Closed
8 tasks done

Sugar API for registering services + automated registration via boot #1439

bajtos opened this issue Jun 19, 2018 · 1 comment
Assignees

Comments

@bajtos
Copy link
Member

bajtos commented Jun 19, 2018

At the moment, @loopback/boot is able to automatically load datasources and model repositories from project files. We should add support for loading services too.

See #1347 for an example implementation.

Acceptance criteria

@bajtos
Copy link
Member Author

bajtos commented Jul 30, 2018

Proposed implementation (see #1347):

service<T>(provider: Constructor<Provider<T>>) {
  const key = `services.${provider.name.replace(/Provider$/, '')}`;
  this.bind(key).toProvider(provider);
}

I am proposing to call the new method serviceProvider in order to avoid possible confusion about the type passed to the sugar API (a Provider vs. a service class), because other sugar-API methods like controller, repository and dataSource are accepting a class constructor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants