jaguar_boilerplate 2.4.1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 46

boilerplate for Jaguar projects

This project contains a simple example shows how to add routes to Jaguar using Controller classes.

The repository can be found at: https://github.com/jaguar-examples/boilerplate. One would typically want to clone it and edit it in IntelliJ IDE.

Server description

It exposes four routes for demonstration purposes:

  1. A simple GET route
  2. A simple POST route that uses query parameters
  3. A simple JSON GET route
  4. A simple JSON POST route that has JSON body
@Controller(path: '/api')
class ExampleApi {
  // A simple get route
  @Get(path: '/version')
  double version(_) => 0.1;

  // A simple post route
  @Post(path: '/add')
  int add(Context ctx) => ctx.query.getInt('a') + ctx.query.getInt('b');

  // A simple get JSON route
  @GetJson(path: '/info')
  Map info(_) => {
    'server': 'Jaguar',
    'motto': 'Simple. Fast. Flexible. Extensible.',
  };

  // A simple post JSON route
  @PostJson(path: '/sub')
  Future<Map> sub(Context ctx) async {
    Map body = await ctx.bodyAsJsonMap();
    return {'result': body['a'] - body['b']};
  }
}

Client description

Contains code to access the example server.

Future<Null> execVersion() async {
  String url = "http://$kHostname:$kPort/api/version";
  http.Response resp = await _client.get(url);
  print(resp.body);
}

Future<Null> execAdd() async {
  http.Response resp = await _client.post(
      new Uri.http('$kHostname:$kPort', '/api/add', {'a': '5', 'b': '20'}));
  print(resp.body);
}

Future<Null> execInfo() async {
  String url = "http://$kHostname:$kPort/api/info";
  http.Response resp = await _client.get(url);
  print(resp.body);
}

Future<Null> execSubtract() async {
  String url = "http://$kHostname:$kPort/api/sub";
  http.Response resp = await _client.post(url, body: '{"a": 10, "b": 5}');
  print(resp.body);
}

main() async {
  await execVersion();
  await execAdd();
  await execInfo();
  await execSubtract();
}

2.2.0

Upgraded to Jaguar 2.2.0

Use this package as an executable

1. Install it

You can install the package from the command line:


$ pub global activate jaguar_boilerplate

2. Use it

The package has the following executables:


$ jaguar_boilerplate_client
$ jaguar_boilerplate_server
Version Uploaded Documentation Archive
2.4.1 Sep 18, 2018 Go to the documentation of jaguar_boilerplate 2.4.1 Download jaguar_boilerplate 2.4.1 archive
2.2.0 Aug 15, 2018 Go to the documentation of jaguar_boilerplate 2.2.0 Download jaguar_boilerplate 2.2.0 archive
2.1.2 Aug 13, 2018 Go to the documentation of jaguar_boilerplate 2.1.2 Download jaguar_boilerplate 2.1.2 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
46
Learn more about scoring.

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

  • Dart: 2.0.0
  • pana: 0.12.6

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in libraries.

Health suggestions

Format bin/server.dart.

Run dartfmt to format bin/server.dart.

Maintenance issues and suggestions

Running dartdoc failed. (-10 points)

Make sure dartdoc runs without any issues.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use jaguar_boilerplate.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
http ^0.11.3 0.11.3+17 0.12.0
jaguar ^2.4.4 2.4.10
jaguar_reflect ^2.4.0 2.4.1
Transitive dependencies
async 2.0.8
auth_header 2.1.2
charcode 1.1.2
collection 1.14.11
convert 2.0.2
crypto 2.0.6
http_parser 3.1.3
http_server 0.9.8+1
jaguar_common 2.1.4
logging 0.11.3+2
meta 1.1.6
mime 0.9.6+2
path 1.6.2
path_tree 2.2.2
source_span 1.4.1
stack_trace 1.9.3
string_scanner 1.0.4
typed_data 1.1.6