| OLD | NEW |
| 1 Route | 1 Route |
| 2 ===== | 2 ===== |
| 3 | 3 |
| 4 Route is a client + server routing library for Dart that helps make building | 4 Route is a client + server routing library for Dart that helps make building |
| 5 single-page web apps and using `HttpServer` easier. | 5 single-page web apps and using `HttpServer` easier. |
| 6 | 6 |
| 7 Installation | 7 Installation |
| 8 ------------ | 8 ------------ |
| 9 | 9 |
| 10 Add this package to your pubspec.yaml file: | 10 Add this package to your pubspec.yaml file: |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 -------------- | 150 -------------- |
| 151 | 151 |
| 152 On the server, route gives you a utility function to match `HttpRequest`s | 152 On the server, route gives you a utility function to match `HttpRequest`s |
| 153 against `UrlPatterns`. | 153 against `UrlPatterns`. |
| 154 | 154 |
| 155 ```dart | 155 ```dart |
| 156 import 'urls.dart'; | 156 import 'urls.dart'; |
| 157 import 'package:route_hierarchical/server.dart'; | 157 import 'package:route_hierarchical/server.dart'; |
| 158 import 'package:route_hierarchical/pattern.dart'; | 158 import 'package:route_hierarchical/pattern.dart'; |
| 159 | 159 |
| 160 HttpServer.bind('0.0.0.0', 8888).then((server) { | 160 HttpServer.bind().then((server) { |
| 161 var router = new Router(server) | 161 var router = new Router(server) |
| 162 ..filter(matchesAny(allUrls), authFilter) | 162 ..filter(matchesAny(allUrls), authFilter) |
| 163 ..serve(homeUrl).listen(serverHome) | 163 ..serve(homeUrl).listen(serverHome) |
| 164 ..serve(articleUrl, method: 'GET').listen(serveArticle); | 164 ..serve(articleUrl, method: 'GET').listen(serveArticle); |
| 165 }); | 165 }); |
| 166 | 166 |
| 167 Future<bool> authFilter(req) { | 167 Future<bool> authFilter(req) { |
| 168 return getUser(getUserIdCookie(req)).then((user) { | 168 return getUser(getUserIdCookie(req)).then((user) { |
| 169 if (user != null) { | 169 if (user != null) { |
| 170 return true; | 170 return true; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 184 ------------- | 184 ------------- |
| 185 | 185 |
| 186 * Integration with Web UI so that the changing of UI views can happen | 186 * Integration with Web UI so that the changing of UI views can happen |
| 187 automatically. | 187 automatically. |
| 188 * Handling different HTTP methods to help implement REST APIs. | 188 * Handling different HTTP methods to help implement REST APIs. |
| 189 * Automatic generation of REST URLs from a single URL pattern, similar to Ruby | 189 * Automatic generation of REST URLs from a single URL pattern, similar to Ruby |
| 190 on Rails | 190 on Rails |
| 191 * Helpers for nested views and key-value URL schemes common with complex apps. | 191 * Helpers for nested views and key-value URL schemes common with complex apps. |
| 192 * [Done] ~~Server-side routing for the dart:io v2 HttpServer~~ | 192 * [Done] ~~Server-side routing for the dart:io v2 HttpServer~~ |
| 193 * [Done] ~~IE 9 support~~ | 193 * [Done] ~~IE 9 support~~ |
| OLD | NEW |