kite_http 0.1.1 kite_http: ^0.1.1 copied to clipboard
A basic HTTP server library that support json & middleware
example/kite_http_example.dart
import 'package:kite_http/kite_http.dart';
void main() {
final server = KiteServer();
server.use(middleware);
server.handle(
HandlerMetadata(
RegExp(
r"(\/)?",
multiLine: true,
caseSensitive: false,
),
"GET",
),
handler,
);
server.listen();
}
void middleware(Request req, Response res, Function() next) async {
next();
}
void handler(Request req, Response res) async {
final body = await req.json;
return res.json(body);
}