tiga 0.0.1 tiga: ^0.0.1 copied to clipboard
A Web Framework For Dart Serve
import 'package:tiga/tiga.dart';
main() {
createWebHostBuilder("localhost", 8080).build().run();
}
WebHostBuilder createWebHostBuilder(String address, int port) {
return WebHostBuilder()
.useHttpListener(address, port)
.addMiddleware(fooMiddleware)
.addMiddleware(headerMiddleware);
}
RequestDelegate fooMiddleware(RequestDelegate next) {
return (context) {
context.response.writeAsync("Foo==>");
next(context);
};
}
RequestDelegate headerMiddleware(RequestDelegate next) {
return (context) {
context.response.writeAsync("header==>");
next(context);
};
}