jaguar_reflect 2.4.6

  • Readme
  • Changelog
  • Example
  • Installing
  • 74

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 {
  @Get()
  Response<String> addBook(Context ctx) => Response.json(book.toMap());
}

Future<Null> main(List<String> args) async {
  final jaguar = new Jaguar(port: 8005);
  jaguar.addApi(reflect(new BooksApi()));
  await jaguar.serve();
}

Changelog #

2.4.6 #

  • Websocket support

2.4.4 #

  • Support for dontBind

2.4.2 #

  • Bindings

2.1.6 #

  • Dart 2 stable

2.1.3 #

  • Dart2 fixes

1.3.1 #

  • Faster processing of simple routes

1.2.6 #

  • Allow Symbols in Wrap and WrapOne

1.2.1 #

  • Wrap and WrapOne now take InterceptorCreator creator instead of Symbol

1.1.5 #

  • Bump to version 1.x.x

0.7.0 #

  • Jaguar 0.7.x

0.3.3 #

  • Collect inherited wrappers

0.3.2 #

  • Detect interceptor wrappers on RouteGroups and Apis

0.3.1 #

  • Fixed bug involving multiple groups

0.0.1 #

  • Initial version, created by Stagehand

example/example.dart

library jaguar.example.routes;

import 'package:jaguar/jaguar.dart';
import 'package:jaguar_reflect/jaguar_reflect.dart';

@GenController()
class ExampleController extends Controller {
  @Get()
  String get(Context ctx) => 'Get';

  @Post()
  String post(_) => 'Post';

  @Put()
  String put(_) => 'Put';

  @Delete()
  String delete(_) => 'Delete';

  @override
  void before(Context ctx) {
    print("here");
  }
}

main() async {
  Jaguar server = new Jaguar(port: 10000);
  server.add(reflect(new ExampleController()));
  await server.serve();
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  jaguar_reflect: ^2.4.6

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:jaguar_reflect/jaguar_reflect.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
52
Health:
Code health derived from static analysis. [more]
97
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
95
Overall:
Weighted score of the above. [more]
74
Learn more about scoring.

We analyzed this package on Nov 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21

Platforms

Detected platforms: other

Primary library: package:jaguar_reflect/jaguar_reflect.dart with components: io, mirrors.

Health suggestions

Fix lib/reflect/reflect.dart. (-2.96 points)

Analysis of lib/reflect/reflect.dart reported 6 hints, including:

line 37 col 7: DO use curly braces for all flow control structures.

line 86 col 9: Use isEmpty instead of length

line 94 col 7: DO use curly braces for all flow control structures.

line 96 col 7: DO use curly braces for all flow control structures.

line 112 col 9: Use isEmpty instead of length

Fix lib/bind/bind.dart. (-0.50 points)

Analysis of lib/bind/bind.dart reported 1 hint:

line 20 col 7: DO use curly braces for all flow control structures.

Maintenance suggestions

Homepage URL is insecure. (-5 points)

Update the homepage field and use a secure (https) URL.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.65 <3.0.0
jaguar ^2.4.32 2.4.36
meta >1.1.0 <2.0.0 1.1.8
Transitive dependencies
auth_header 2.1.4
charcode 1.1.2
collection 1.14.12
convert 2.1.1
crypto 2.1.3
http_server 0.9.8+3
jaguar_common 2.1.4
jaguar_serializer 2.2.12
logging 0.11.3+2
mime 0.9.6+3
path 1.6.4
path_tree 2.2.2
stack_trace 1.9.3
typed_data 1.1.6
Dev dependencies
http ^0.12.0
jaguar_resty ^2.8.0
test ^1.3.0