jaguar_reflect 0.5.2 copy "jaguar_reflect: ^0.5.2" to clipboard
jaguar_reflect: ^0.5.2 copied to clipboard

outdatedDart 1 only

**DEPRECATED: jaguar_reflect is now merged into jaguar**. Reflection based alternative for Jaguar

DEPRECATED: jaguar_reflect is now merged into jaguar

jaguar_reflect #

Uses reflection instead of source generation to serve Jaguar Api classes

Usage #

A simple usage example:

final book = new Book.make('0', 'Book1', ['Author1', 'Author2']);

@Api(path: '/api/book')
class BooksApi {
  @Post()
  Future<Response<String>> addBook(Context ctx) async {
    // Decode request body as JSON Map
    final Map<String, dynamic> json = await ctx.req.bodyAsJsonMap();
    Book book = new Book()..fromMap(json);
    print(book.toMap());
    // Encode Map to JSON
    return Response.json(book.toMap());
  }
}

Future<Null> main(List<String> args) async {
  Jaguar jaguar = new Jaguar();
  jaguar.addApiReflected(new BooksApi());

  await jaguar.serve();
}
1
likes
0
pub points
0%
popularity

Publisher

unverified uploader

**DEPRECATED: jaguar_reflect is now merged into jaguar**. Reflection based alternative for Jaguar

Homepage

License

unknown (LICENSE)

Dependencies

jaguar, quiver

More

Packages that depend on jaguar_reflect