Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@graphicbeacon
Last active May 16, 2018 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save graphicbeacon/833289a959ac8ce39f98f402dd3421bc to your computer and use it in GitHub Desktop.
Save graphicbeacon/833289a959ac8ce39f98f402dd3421bc to your computer and use it in GitHub Desktop.
Sample code for "Building RESTful Web APIs with Dart, Aqueduct and PostgreSQL (Part 2)" post on Medium
@override
void setupRouter((Router router) async {
router.route('/books[/:index]').listen((Request incomingRequest) async {
return new Response.ok('Showing all books.');
});
router.route('/').listen((Request incomingRequest) async {
return new Response.ok('<h1>Welcome to FaveReads</h1>')
..contentType = ContentType.HTML;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment