OLD | NEW |
---|---|
(Empty) | |
1 --- | |
2 layout: article | |
3 title: "Command-Line Apps" | |
4 description: "Documentation, references, and more about server-side programming. " | |
5 has-permalinks: true | |
6 --- | |
7 | |
8 {% include docs_toc.html %} | |
9 | |
10 # {{ page.title }} | |
11 | |
12 You can use Dart for any kind of command-line app from scripts to servers. | |
13 | |
14 ## Show me the code | |
15 | |
16 If you prefer to plow through code, start here. | |
Shams
2014/01/03 00:28:17
Does Google have a standard for verbiage for links
mem
2014/01/03 00:35:02
Done.
| |
17 These samples progress from simple to complex | |
18 and illustrate a variety of APIs specific to command-line apps and servers. | |
19 | |
20 <hr> | |
21 | |
22 <div class="row"> | |
23 <div class="col-md-5"> | |
24 | |
25 ### Best place to start | |
26 | |
27 * [Dart by Example](/dart-by-example/#dart-io-and-command-line-apps) | |
28 | |
29 </div> | |
30 <div class="col-md-7"> | |
31 | |
32 #### Top 10 | |
33 | |
34 10. Using files, directories, and symlinks | |
35 9. Reading and writing files | |
36 8. Listing contents of directories | |
37 7. Using streams | |
38 6. Making HTTP requests | |
39 5. Getting the response | |
40 4. Handling errors | |
41 3. Serving index.html | |
42 2. Adding custom headers | |
43 1. Implementing an HTTP server | |
44 0. ...and more... | |
45 | |
46 </div> | |
47 </div> | |
48 | |
49 <hr> | |
50 | |
51 <div class="row"> | |
52 <div class="col-md-5"> | |
53 | |
54 ### Basic command-line apps | |
55 | |
56 * [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 </div> | |
59 <div class="col-md-7"> | |
60 | |
61 #### APIs | |
62 | |
63 * parsing command-line arguments | |
Shams
2014/01/03 00:28:17
The first section uses a numbered list and the fir
mem
2014/01/03 00:35:02
keeping the numbered list because it's the top 10.
| |
64 * reading a file | |
65 * converting data | |
66 * using stdin, stdout, and stderr | |
67 * listing a directory recursively | |
68 * testing and getting information about paths | |
69 </div> | |
70 </div> | |
71 | |
72 <hr> | |
73 | |
74 <div class="row"> | |
75 <div class="col-md-5"> | |
76 | |
77 #### Servers | |
78 | |
79 * [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) | |
81 | |
82 </div> | |
83 <div class="col-md-7"> | |
84 | |
85 #### APIs | |
86 | |
87 * using the HttpServer class | |
88 * handling GET, POST, and OPTIONS requests | |
89 * using CORS headers | |
90 * using WebSockets | |
91 * getting responses | |
92 * routing requests | |
93 * handling errors | |
94 | |
95 </div> | |
96 </div> | |
97 | |
98 <hr> | |
99 | |
100 ## Read all about it | |
101 | |
102 Follow these links in order to gain a full understaning | |
Shams
2014/01/03 00:28:17
spelling...
mem
2014/01/03 00:35:02
Done.
| |
103 of how to write various kinds of command-line apps in Dart using | |
104 various Dart libraries and packages. | |
Shams
2014/01/03 00:28:17
Use a different word (various twice in the same se
mem
2014/01/03 00:35:02
Done.
| |
105 | |
106 ### Prerequisites (dart:async library) | |
107 | |
108 * [Use Future-Based APIs](/docs/tutorials/futures/) | |
109 <img src="/docs/tutorials/images/target.png" height="16" width="16"> | |
110 * [Use Streams for Data](/docs/tutorials/streams/) | |
111 <img src="/docs/tutorials/images/target.png" height="16" width="16"> | |
112 | |
113 ### The Basics | |
114 | |
115 * [Write a Command-Line App](/docs/tutorials/cmdline/) | |
116 <img src="/docs/tutorials/images/target.png" height="16" width="16"> | |
117 | |
118 ### Servers | |
119 | |
120 * [Get Input from a Form](/docs/tutorials/forms/) | |
121 <img src="/docs/tutorials/images/target.png" height="16" width="16"> | |
122 (contains an HTTP server/client pair) | |
123 * [Walkthrough: Dartiverse Search](/docs/dart-up-and-running/contents/ch05.html) | |
124 * [Deploy to Heroku](https://github.com/igrigorik/heroku-buildpack-dart) | |
125 | |
126 {% comment %} | |
127 * How to write a basic server using http_server package (sample link) | |
128 * How to write a web server (sample link) | |
129 * How to use Heroku to deploy (external link) | |
130 | |
131 #### Other server-specific tasks | |
132 | |
133 * How to perform server-side templating (??) | |
134 * How to use SSL to perform secure web messaging (??) | |
135 * Use zones for more control over your asychronous computations (??) | |
136 * How to write a long-running server (??) | |
137 * Using TCP for reliable transmissions (??) | |
138 * Using UDP for lightweight, efficient transmissions (??) | |
139 * Connecting to the postgres database (and concepts for other databases) (??) | |
140 * URL routing for god knows what purpose (??) | |
141 | |
142 {% endcomment %} | |
143 | |
144 ### Reference docs | |
145 | |
146 * [dart:io](https://api.dartlang.org/dart_io.html) | |
147 * [args package](https://api.dartlang.org/args.html) | |
148 * [dart:async](https://api.dartlang.org/dart_async.html) | |
149 * [dart:convert](https://api.dartlang.org/dart_convert.html) | |
OLD | NEW |