cruky 0.6.0 cruky: ^0.6.0 copied to clipboard
cruky is server-side library to create API with modern and fast performance.
import 'package:cruky/cruky.dart';
void main() => run(MyApp());
class MyApp extends AppMaterial {
@override
List get routes => [
exampleWithGETRequest,
];
@override
List get middlewares => [middlewareExample];
}
@Route.get('/')
exampleWithGETRequest(ReqCTX req) {
return Json({});
}
@BeforeMW()
middlewareExample(ReqCTX req) {
if (req.headerValue('Token') == null) {
return Text('Not Auth', 401);
}
}