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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« pkg/http_server/README.md ('K') | « pkg/http_server/README.md ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// 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.
6 ///
7 /// ## Installing ##
8 ///
9 /// Use [pub][] to install this package. Add the following to your
10 /// `pubspec.yaml` file.
11 ///
12 /// dependencies:
13 /// http_server: any
14 ///
15 /// Then run `pub install`.
16 ///
17 /// For more information, see the
18 /// [http_server package on pub.dartlang.org][pub].
19 ///
20 /// ## Basic usage
21 ///
22 /// Here is a short example of how to serve all files from the current
23 /// directory.
24 ///
25 /// import 'dart:io';
26 /// import 'dart:async';
27 /// import 'package:http_server/http_server.dart';
28 ///
29 /// void main() {
30 /// var staticFiles = new VirtualDirectory('.')
31 /// ..allowDirectoryListing = true;
32 ///
33 /// runZoned(() {
34 /// HttpServer.bind('0.0.0.0', 7777).then((server) {
35 /// print('Server running');
36 /// server.listen(staticFiles.serveRequest);
37 /// });
38 /// },
39 /// onError: (e, stackTrace) => print('Oh noes! $e $stackTrace'));
40 /// }
41 ///
42 /// ## 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.
43 ///
44 /// The VirtualDirectory class makes it easy to serve static content
45 /// from the file system. It supports:
46 ///
47 /// * Range-based requests.
48 /// * If-Modified-Since based caching.
49 /// * Automatic GZip-compression of content.
50 /// * Following symlinks, either throughout the system or inside
51 /// a jailed root.
52 /// * Directory listing.
53 ///
54 /// 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.
55 ///
56 /// ## Virtual host
57 ///
58 /// The VirtualHost class helps to serve multiple hosts on the same
59 /// address, by using the `Host` field of the incoming requests. It also
60 /// works with wildcards for sub-domains.
61 ///
62 /// var virtualHost = new VirtualHost(server);
63 /// // Filter out on a specific host
64 /// var stream1 = virtualServer.addHost('static.myserver.com');
65 /// // Wildcard for any other sub-domains.
66 /// var stream2 = virtualServer.addHost('*.myserver.com');
67 /// // Requets not matching any hosts.
68 /// var stream3 = virtualServer.unhandled;
69 ///
70 /// See [VirtualHost][virtualhostdocs] for more information.
71 ///
72 /// [pub]: http://pub.dartlang.org/packages/http_server
73 /// [virtualdirdocs]: https://api.dartlang.org/docs/channels/stable/latest/http_ server/VirtualDirectory.html
74 /// [virtualhostdocs]: https://api.dartlang.org/docs/channels/stable/latest/http _server/VirtualHost.html
5 library http_server; 75 library http_server;
6 76
7 import 'dart:async'; 77 import 'dart:async';
8 import 'dart:convert'; 78 import 'dart:convert';
9 import 'dart:io'; 79 import 'dart:io';
10 80
11 import 'package:mime/mime.dart'; 81 import 'package:mime/mime.dart';
12 import "package:path/path.dart"; 82 import "package:path/path.dart";
13 83
14 part 'src/http_body.dart'; 84 part 'src/http_body.dart';
15 part 'src/http_body_impl.dart'; 85 part 'src/http_body_impl.dart';
16 part 'src/http_multipart_form_data.dart'; 86 part 'src/http_multipart_form_data.dart';
17 part 'src/http_multipart_form_data_impl.dart'; 87 part 'src/http_multipart_form_data_impl.dart';
18 part 'src/virtual_directory.dart'; 88 part 'src/virtual_directory.dart';
19 part 'src/virtual_host.dart'; 89 part 'src/virtual_host.dart';
20 90
OLDNEW
« 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