Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Unified Diff: pkg/http_server/lib/http_server.dart

Issue 113733002: move contents of readme into library docs (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: tweaks from review Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/http_server/README.md ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http_server/lib/http_server.dart
diff --git a/pkg/http_server/lib/http_server.dart b/pkg/http_server/lib/http_server.dart
index aad6401efaf545dfac9db488035c80379a10d973..afaf71c383b52b87717c95d9caa779c12ac04f3b 100644
--- a/pkg/http_server/lib/http_server.dart
+++ b/pkg/http_server/lib/http_server.dart
@@ -2,6 +2,76 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+/**
+ * A library for serving HTTP requests and resources.
+ *
+ * ## Installing ##
+ *
+ * Use [pub][] to install this package. Add the following to your
+ * `pubspec.yaml` file.
+ *
+ * dependencies:
+ * http_server: any
+ *
+ * Then run `pub install`.
+ *
+ * For more information, see the
+ * [http_server package on pub.dartlang.org][pub].
+ *
+ * ## Basic usage
+ *
+ * Here is a short example of how to serve all files from the current
+ * directory.
+ *
+ * import 'dart:io';
+ * import 'dart:async';
+ * import 'package:http_server/http_server.dart';
+ *
+ * void main() {
+ * var staticFiles = new VirtualDirectory('.')
+ * ..allowDirectoryListing = true;
+ *
+ * runZoned(() {
+ * HttpServer.bind('0.0.0.0', 7777).then((server) {
+ * print('Server running');
+ * server.listen(staticFiles.serveRequest);
+ * });
+ * },
+ * onError: (e, stackTrace) => print('Oh noes! $e $stackTrace'));
+ * }
+ *
+ * ## Virtual directory
+ *
+ * The [VirtualDirectory] class makes it easy to serve static content
+ * from the file system. It supports:
+ *
+ * * Range-based requests.
+ * * If-Modified-Since based caching.
+ * * Automatic GZip-compression of content.
+ * * Following symlinks, either throughout the system or inside
+ * a jailed root.
+ * * Directory listing.
+ *
+ * See [VirtualDirectory] for more information.
+ *
+ * ## Virtual host
+ *
+ * The [VirtualHost] class helps to serve multiple hosts on the same
+ * address, by using the `Host` field of the incoming requests. It also
+ * works with wildcards for sub-domains.
+ *
+ * var virtualHost = new VirtualHost(server);
+ * // Filter out on a specific host
+ * var stream1 = virtualServer.addHost('static.myserver.com');
+ * // Wildcard for any other sub-domains.
+ * var stream2 = virtualServer.addHost('*.myserver.com');
+ * // Requets not matching any hosts.
+ * var stream3 = virtualServer.unhandled;
+ *
+ * See [VirtualHost] for more information.
+ *
+ * [pub]: http://pub.dartlang.org/packages/http_server
+ */
library http_server;
import 'dart:async';
« no previous file with comments | « pkg/http_server/README.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698