cruky 1.1.0 copy "cruky: ^1.1.0" to clipboard
cruky: ^1.1.0 copied to clipboard

discontinuedreplaced by: croky
SDKDart

cruky is server-side library to create API with modern and fast performance.

example/main.dart

import 'package:cruky/cruky.dart';

void main() => runApp(MyApp());

class MyApp extends ServerApp {
  @override
  List get routes => [
        example,
        ExampleApp(),
      ];
}

@Route.get('/:id(string)', pipeline: [middlewareExample])
String example(Request req) {
  return req.path['id'];
}

@UsePre()
middlewareExample(Request req) {
  if (req.headerValue('Authorization') == null) {
    return Text('Not Auth', 401);
  } else {
    req.parser[#token] = req.headerValue('Authorization')!;
  }
}

class ExampleApp extends AppMaterial {
  @override
  String get prefix => '/example';

  @override
  List get routes => [
        getExample,
      ];

  @Route.get('/get')
  getExample(Request req) {
    return Text('Nested apps');
  }
}
1
likes
140
pub points
0%
popularity

Publisher

unverified uploader

cruky is server-side library to create API with modern and fast performance.

Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

MIT (LICENSE)

Dependencies

ansicolor, args, meta, mime, path, vm_service, watcher

More

Packages that depend on cruky