Last active
May 16, 2018 21:32
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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