Service is a class decorated with @Service, and can be injected into any other classes like Controller, Middleware.
Service uses dependency injection, for the details: wiki
@Service()
class UserService {
// any logic
}
@RestController('/users')
class UserController {
@Inject()
private userService: UserService;
@Get('')
public indexAction() {
this.userService.listUsers();
}
}The example UserService decorated with @Service, and then it is used in UserController.