| OLD | NEW |
| 1 --- | 1 --- |
| 2 layout: default | 2 layout: default |
| 3 title: "Command-Line Apps" | 3 title: "Command-Line Apps" |
| 4 description: "Documentation, references, and more about server-side programming.
" | 4 description: "Documentation, references, and more about server-side programming.
" |
| 5 has-permalinks: true | 5 has-permalinks: true |
| 6 --- | 6 --- |
| 7 | 7 |
| 8 # {{ page.title }} | 8 # {{ page.title }} |
| 9 | 9 |
| 10 You can use Dart for any kind of command-line app from scripts to servers. | 10 You can use Dart for any kind of command-line app from scripts to servers. |
| 11 | 11 |
| 12 {% include guide_toc.html %} | 12 {% include default_toc.html %} |
| 13 | 13 |
| 14 ## Show me the code | 14 ## Show me the code |
| 15 | 15 |
| 16 If you prefer to plow through code, start with the following examples. | 16 If you prefer to plow through code, start with the following examples. |
| 17 These samples progress from simple to complex | 17 These samples progress from simple to complex |
| 18 and illustrate a variety of APIs specific to command-line apps and servers. | 18 and illustrate a variety of APIs specific to command-line apps and servers. |
| 19 | 19 |
| 20 <hr> | 20 <hr> |
| 21 | 21 |
| 22 <div class="row"> | 22 <div class="row"> |
| 23 <div class="col-md-5" markdown="1"> | 23 <div class="col-md-5" markdown="1"> |
| 24 | 24 |
| 25 ### Best place to start | 25 ### Best place to start |
| 26 | 26 |
| 27 * [Dart by Example](/dart-by-example/#dart-io-and-command-line-apps) | 27 * [Dart by Example](/dart-by-example/#dart-io-and-command-line-apps) |
| 28 | 28 |
| 29 </div> | 29 </div> |
| 30 <div class="col-md-7" markdown="1"> | 30 <div class="col-md-7" markdown="1"> |
| 31 | 31 |
| 32 #### Top 10 | 32 #### Top 10 |
| 33 {:.no_toc} |
| 33 | 34 |
| 34 10. Using files, directories, and symlinks | 35 10. Using files, directories, and symlinks |
| 35 9. Reading and writing files | 36 9. Reading and writing files |
| 36 8. Listing contents of directories | 37 8. Listing contents of directories |
| 37 7. Using streams | 38 7. Using streams |
| 38 6. Making HTTP requests | 39 6. Making HTTP requests |
| 39 5. Getting the response | 40 5. Getting the response |
| 40 4. Handling errors | 41 4. Handling errors |
| 41 3. Serving index.html | 42 3. Serving index.html |
| 42 2. Adding custom headers | 43 2. Adding custom headers |
| 43 1. Implementing an HTTP server | 44 1. Implementing an HTTP server |
| 44 0. ...and more... | 45 0. ...and more... |
| 45 | 46 |
| 46 </div> | 47 </div> |
| 47 </div> | 48 </div> |
| 48 | 49 |
| 49 <hr> | 50 <hr> |
| 50 | 51 |
| 51 <div class="row"> | 52 <div class="row"> |
| 52 <div class="col-md-5" markdown="1"> | 53 <div class="col-md-5" markdown="1"> |
| 53 | 54 |
| 54 ### Basic command-line apps | 55 ### Basic command-line apps |
| 55 | 56 |
| 56 * [dcat](https://code.google.com/p/dart/source/browse/branches/bleeding_edge/dar
t/samples/dcat/README.md) | 57 * [dcat](https://code.google.com/p/dart/source/browse/branches/bleeding_edge/dar
t/samples/dcat/README.md) |
| 57 * [dgrep](https://code.google.com/p/dart/source/browse/branches/bleeding_edge/da
rt/samples/dgrep/README.md) | 58 * [dgrep](https://code.google.com/p/dart/source/browse/branches/bleeding_edge/da
rt/samples/dgrep/README.md) |
| 58 </div> | 59 </div> |
| 59 <div class="col-md-7" markdown="1"> | 60 <div class="col-md-7" markdown="1"> |
| 60 | 61 |
| 61 #### APIs | 62 #### APIs |
| 63 {:.no_toc} |
| 62 | 64 |
| 63 * Parsing command-line arguments | 65 * Parsing command-line arguments |
| 64 * Reading a file | 66 * Reading a file |
| 65 * Converting data | 67 * Converting data |
| 66 * Using stdin, stdout, and stderr | 68 * Using stdin, stdout, and stderr |
| 67 * Listing a directory recursively | 69 * Listing a directory recursively |
| 68 * Testing and getting information about paths | 70 * Testing and getting information about paths |
| 69 </div> | 71 </div> |
| 70 </div> | 72 </div> |
| 71 | 73 |
| 72 <hr> | 74 <hr> |
| 73 | 75 |
| 74 <div class="row"> | 76 <div class="row"> |
| 75 <div class="col-md-5" markdown="1"> | 77 <div class="col-md-5" markdown="1"> |
| 76 | 78 |
| 77 #### Servers | 79 #### Servers |
| 80 {:.no_toc} |
| 78 | 81 |
| 79 * [slambookserver](https://github.com/dart-lang/dart-tutorials-samples/blob/mast
er/web/slambook/) | 82 * [slambookserver](https://github.com/dart-lang/dart-tutorials-samples/blob/mast
er/web/slambook/) |
| 80 * [dartiverse_search](https://code.google.com/p/dart/source/browse/branches/blee
ding_edge/dart/samples/dartiverse_search/readme.txt) | 83 * [dartiverse_search](https://code.google.com/p/dart/source/browse/branches/blee
ding_edge/dart/samples/dartiverse_search/readme.txt) |
| 81 | 84 |
| 82 </div> | 85 </div> |
| 83 <div class="col-md-7" markdown="1"> | 86 <div class="col-md-7" markdown="1"> |
| 84 | 87 |
| 85 #### APIs | 88 #### APIs |
| 89 {:.no_toc} |
| 86 | 90 |
| 87 * Using the HttpServer class | 91 * Using the HttpServer class |
| 88 * Handling GET, POST, and OPTIONS requests | 92 * Handling GET, POST, and OPTIONS requests |
| 89 * Using CORS headers | 93 * Using CORS headers |
| 90 * Using WebSockets | 94 * Using WebSockets |
| 91 * Getting responses | 95 * Getting responses |
| 92 * Routing requests | 96 * Routing requests |
| 93 * Handling errors | 97 * Handling errors |
| 94 | 98 |
| 95 </div> | 99 </div> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 138 |
| 135 * [dart:io](https://api.dartlang.org/dart_io.html)— | 139 * [dart:io](https://api.dartlang.org/dart_io.html)— |
| 136 Includes support for UDP, TCP, HTTP client and server, | 140 Includes support for UDP, TCP, HTTP client and server, |
| 137 files, directories, web sockets, processes, server sockets, and more. | 141 files, directories, web sockets, processes, server sockets, and more. |
| 138 * [args package](https://api.dartlang.org/args.html)— | 142 * [args package](https://api.dartlang.org/args.html)— |
| 139 Help with handling command-line arguments. | 143 Help with handling command-line arguments. |
| 140 * [dart:async](https://api.dartlang.org/dart_async.html)— | 144 * [dart:async](https://api.dartlang.org/dart_async.html)— |
| 141 Asynchronous programming with Futures, Streams. | 145 Asynchronous programming with Futures, Streams. |
| 142 * [dart:convert](https://api.dartlang.org/dart_convert.html)— | 146 * [dart:convert](https://api.dartlang.org/dart_convert.html)— |
| 143 Converters for data types such as JSON and UTF-8. | 147 Converters for data types such as JSON and UTF-8. |
| OLD | NEW |