coruja 0.0.1 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.
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();
}