shelf_plus 1.0.1 copy "shelf_plus: ^1.0.1" to clipboard
shelf_plus: ^1.0.1 copied to clipboard

outdated

Shelf Plus is a quality of life addon for your server-side development within the Shelf platform.

example/example.dart

import 'dart:io';

import 'package:shelf_plus/shelf_plus.dart';

void main() => shelfRun(init);

Handler init() {
  var app = Router().plus;

  app.get('/text', () => 'a text');

  app.get('/binary', () => File('data.zip').openRead());

  app.get('/json', () => {'name': 'John', 'age': 42});

  app.get('/class', () => Person('Theo'));

  app.get('/handler', () => typeByExtension('html') >> '<h1>Hello</h1>');

  app.get('/file', () => File('thesis.pdf'));

  return app;
}

class Person {
  final String name;

  Person(this.name);

  // can be generated by tools (i.e. json_serializable package)
  Map<String, dynamic> toJson() => {'name': name};
}
97
likes
0
pub points
88%
popularity

Publisher

verified publisherfelix-blaschke.de

Shelf Plus is a quality of life addon for your server-side development within the Shelf platform.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

mime_type, shelf, shelf_hotreload, shelf_router, shelf_static, supercharged_dart

More

Packages that depend on shelf_plus