amix 0.0.11 copy "amix: ^0.0.11" to clipboard
amix: ^0.0.11 copied to clipboard

outdated

Amix is a package for creating Servers.

Amix is a Package for creating Servers.

Features #

With this package, you can easily create your own servers. This package automatically manages your isolates and you don't need to get involved with isolates.

Getting started #

Add the following to your pubspec.yaml file.

dependencies:
  amix: ^0.0.1

Import the package.

import 'package:amix/amix.dart'

Usage #


import 'dart:io';
import 'package:amix/amix.dart';

void main() async {
  AmixSetUp exampleServer = AmixSetUp(serverRoute: AmixRouteExample());
  await exampleServer.startMultiCoreServer(isolateCount: 10);
}

class AmixRouteExample extends AmixRoute {
  @override
  void setEntryPoints() {
    routeController.createRoute(
      "/hi",
      onCall: (AmixRequest request) {
        return AmixResponse(
          response: (response) async {
            try {
              response.write("hello world!!");
              await response.flush();
              await response.close();
            } catch (e) {
              print(e);
            }
          },
        );
      },
    );
  }
  @override
  AmixResponse onPageNotFound() {
    return AmixResponse(
      response: (HttpResponse response) async {
        response.statusCode = 404;
        response.write("Page Not Found 404");
        await response.flush();
        await response.close();
      },
    );
  }
}


Additional information #

0
likes
0
points
75
downloads

Publisher

unverified uploader

Weekly Downloads

Amix is a package for creating Servers.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on amix