coruja 0.0.1 copy "coruja: ^0.0.1" to clipboard
coruja: ^0.0.1 copied to clipboard

A nodeJS express like library. Provides facilities to configure routes to HTTP requests of type GET/POST and ways to change the default request object received by the route function handler.

example/coruja_example.dart

import 'package:coruja/coruja.dart';

void main() {
  var coruja = Coruja();

  coruja.setRequestFactory(CorujaJsonRequestFactory());

  coruja.addGetRoute('/', (request) async {
    var json = await (request as CorujaJsonRequest).json;
    request.writeResponse(content: 'Hello World! Your name is ${json?["nome"]} ${json?["sobrenome"]}.');
  });

  coruja.addGetRoute('/say/hello/to/:name', (request) {
    request.writeResponse(content: 'Hello, ${request.routeParams["name"]}');
  });

  coruja.listen();
}
1
likes
120
pub points
0%
popularity

Publisher

verified publisherdanielprado.dev

A nodeJS express like library. Provides facilities to configure routes to HTTP requests of type GET/POST and ways to change the default request object received by the route function handler.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-2-Clause (LICENSE)

More

Packages that depend on coruja