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

discontinuedreplaced by: croky
SDKDart
outdated

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
150
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