Skip to content

thecodebrothers/launchpad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Launchpad 🚀

Missing dependency injection for serverpod

Let your pod launch with everything onboard!

  • This is BETA *

How to use is it?

First add your dependencies init function - if you are using injectable then this will be your generated getIt.init() function

    // with injectable 
    Launchpad.launchpadInit = (getIt) => getIt.init();
    // or without 
    Launchpad.launchpadInit = (getIt) {
        getIt.registerFactory<String>(() => 'Hello world');
    };

Then in endpoints wrap every request with Launchpad.launch:

class HeloEndpoint extends Endpoint {
  Future<void> helloWorld(
    Session session, {
    required String name,
  }) =>
      Launchpad.launch(
        session,
        (context) async {
          final useCase = context.get<HelloUseCase>();
          return useCase(name: name);
        },
      );
}

TODO:

  • Example
  • Tests
  • Stream support

About

Serverpod missing dependency injection

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages