Boilerplate for jaguar_mux
Switch branches/tags
Nothing to show
Clone or download
Latest commit 2766f78 Sep 18, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Jaguar 2.4.4 Sep 18, 2018
.gitignore Removed dart_tool Jun 27, 2018
CHANGELOG.md Boilerplate for jaguar muxer Mar 3, 2017
LICENSE Boilerplate for jaguar muxer Mar 3, 2017
README.md Jaguar 2.4.4 Sep 18, 2018
analysis_options.yaml Boilerplate for jaguar muxer Mar 3, 2017
pubspec.yaml Jaguar 2.4.4 Sep 18, 2018

README.md

boilerplate_mux

Boilerplate application for Jaguar with a sample HTTP server using mux.

Contains a server built with Jaguar. 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

It also includes a sample client to test these APIs.

import 'package:jaguar/jaguar.dart';

main() async {
  final server = new Jaguar(port: 10000);

  // A simple get route
  server.get('/api/version', (_) => 0.1);

  // A simple post route
  server.post('/api/add',
      (Context ctx) => ctx.query.getInt('a') + ctx.query.getInt('b'));

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

  await server.serve();
}