platform/packages/container/angel_container
thomashii@dukefirehawk.com d4794dbbd1 Upgraded lints to 3.0.0
2023-12-24 09:52:57 +08:00
..
example Fixed requireAuthentication 2021-10-04 13:13:56 +08:00
lib Fixed EmptyReflector 2023-04-15 11:05:33 +08:00
test Upgraded lints to 3.0.0 2023-12-24 09:52:57 +08:00
.gitignore Publish angel3_container 2021-05-14 15:41:25 +08:00
analysis_options.yaml Updated auth, model, container and its generator 2021-09-26 14:53:42 +08:00
AUTHORS.md Publish angel3_container 2021-05-14 15:41:25 +08:00
CHANGELOG.md Upgraded lints to 3.0.0 2023-12-24 09:52:57 +08:00
LICENSE Updated auth, model, container and its generator 2021-09-26 14:53:42 +08:00
melos_angel3_container.iml Added melos 2022-03-19 09:37:28 +08:00
pubspec.yaml Upgraded lints to 3.0.0 2023-12-24 09:52:57 +08:00
README.md Upgraded container_generator 2023-05-21 09:05:14 +08:00

Angel3 Container

Pub Version (including pre-releases) Null Safety Gitter License

A better IoC container for Angel3, ultimately allowing Angel3 to be used with or without dart:mirrors package.

    import 'package:angel3_container/mirrors.dart';
    import 'package:angel3_framework/angel3_framework.dart';
    import 'package:angel3_framework/http.dart';

    @Expose('/sales', middleware: [process1])
    class SalesController extends Controller {
        @Expose('/', middleware: [process2])
        Future<String> route1(RequestContext req, ResponseContext res) async {
            return "Sales route";
        }
    }

    bool process1(RequestContext req, ResponseContext res) {
        res.write('Hello, ');
        return true;
    }

    bool process2(RequestContext req, ResponseContext res) {
        res.write('From Sales, ');
        return true;
    }

    void main() async {
        // Using Mirror Reflector
        var app = Angel(reflector: MirrorsReflector());

        // Sales Controller
        app.container.registerSingleton<SalesController>(SalesController());
        await app.mountController<SalesController>();

        var http = AngelHttp(app);
        var server = await http.startServer('localhost', 3000);
        print("Angel3 server listening at ${http.uri}");
    }