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

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: 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
« pkg/http_server/README.md ('K') | « 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..263c271cee4fdd1fbef6c1eeca631d927b7cb85d 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.
Anders Johnsen 2013/12/12 10:23:33 Please use /** * */ as I do in the rest of
sethladd 2013/12/12 17:09:31 Sure thing.
+///
+/// ## 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
Anders Johnsen 2013/12/12 10:23:33 This could be moved to the VirtualDirectory class
sethladd 2013/12/12 17:09:31 Agreed... I'll do that as step 2.
+///
+/// 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][virtualdirdocs] for more information.
Anders Johnsen 2013/12/12 10:23:33 Why as links? It should link to the correct type w
sethladd 2013/12/12 17:09:31 Yeah, not sure why. Left over from README? Fixed.
+///
+/// ## 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][virtualhostdocs] for more information.
+///
+/// [pub]: http://pub.dartlang.org/packages/http_server
+/// [virtualdirdocs]: https://api.dartlang.org/docs/channels/stable/latest/http_server/VirtualDirectory.html
+/// [virtualhostdocs]: https://api.dartlang.org/docs/channels/stable/latest/http_server/VirtualHost.html
library http_server;
import 'dart:async';
« pkg/http_server/README.md ('K') | « pkg/http_server/README.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698