fallstrick_hosting 0.0.3 copy "fallstrick_hosting: ^0.0.3" to clipboard
fallstrick_hosting: ^0.0.3 copied to clipboard

Code for hosting and starting up an Fallstrick application

example/fallstrick_hosting_example.dart

import 'package:fallstrick_hosting/fallstrick_hosting.dart';

void main() {
  createWebHostBuilder('localhost', 8080).build().run();
}

WebHostBuilder createWebHostBuilder(String address, int port) {
  return WebHostBuilder().useHttpListener(address, port).configure((app) {
    app.use(fooMiddleware);
    app.use(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);
  };
}
0
likes
30
pub points
0%
popularity

Publisher

unverified uploader

Code for hosting and starting up an Fallstrick application

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

More

Packages that depend on fallstrick_hosting