gdritter repos cg / 2ef429e
Server, basic model, db talk, no templating Getty Ritter 7 years ago
7 changed file(s) with 690 addition(s) and 0 deletion(s). Collapse all Expand all
1 /target/
2 **/*.rs.bk
3 *~
1 [root]
2 name = "cg"
3 version = "0.1.0"
4 dependencies = [
5 "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
6 "hyper 0.11.7 (registry+https://github.com/rust-lang/crates.io-index)",
7 "mustache 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
8 "rusqlite 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
9 "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
10 ]
11
12 [[package]]
13 name = "base64"
14 version = "0.6.0"
15 source = "registry+https://github.com/rust-lang/crates.io-index"
16 dependencies = [
17 "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
18 "safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
19 ]
20
21 [[package]]
22 name = "bitflags"
23 version = "0.7.0"
24 source = "registry+https://github.com/rust-lang/crates.io-index"
25
26 [[package]]
27 name = "bitflags"
28 version = "1.0.1"
29 source = "registry+https://github.com/rust-lang/crates.io-index"
30
31 [[package]]
32 name = "byteorder"
33 version = "1.1.0"
34 source = "registry+https://github.com/rust-lang/crates.io-index"
35
36 [[package]]
37 name = "bytes"
38 version = "0.4.5"
39 source = "registry+https://github.com/rust-lang/crates.io-index"
40 dependencies = [
41 "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
42 "iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
43 ]
44
45 [[package]]
46 name = "cfg-if"
47 version = "0.1.2"
48 source = "registry+https://github.com/rust-lang/crates.io-index"
49
50 [[package]]
51 name = "fuchsia-zircon"
52 version = "0.2.1"
53 source = "registry+https://github.com/rust-lang/crates.io-index"
54 dependencies = [
55 "fuchsia-zircon-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
56 ]
57
58 [[package]]
59 name = "fuchsia-zircon-sys"
60 version = "0.2.0"
61 source = "registry+https://github.com/rust-lang/crates.io-index"
62 dependencies = [
63 "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
64 ]
65
66 [[package]]
67 name = "futures"
68 version = "0.1.17"
69 source = "registry+https://github.com/rust-lang/crates.io-index"
70
71 [[package]]
72 name = "futures-cpupool"
73 version = "0.1.7"
74 source = "registry+https://github.com/rust-lang/crates.io-index"
75 dependencies = [
76 "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
77 "num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
78 ]
79
80 [[package]]
81 name = "httparse"
82 version = "1.2.3"
83 source = "registry+https://github.com/rust-lang/crates.io-index"
84
85 [[package]]
86 name = "hyper"
87 version = "0.11.7"
88 source = "registry+https://github.com/rust-lang/crates.io-index"
89 dependencies = [
90 "base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
91 "bytes 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
92 "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
93 "futures-cpupool 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
94 "httparse 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
95 "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
96 "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
97 "mime 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
98 "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
99 "relay 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
100 "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
101 "tokio-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
102 "tokio-io 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
103 "tokio-proto 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
104 "tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
105 "unicase 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
106 ]
107
108 [[package]]
109 name = "iovec"
110 version = "0.1.1"
111 source = "registry+https://github.com/rust-lang/crates.io-index"
112 dependencies = [
113 "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
114 "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
115 ]
116
117 [[package]]
118 name = "kernel32-sys"
119 version = "0.2.2"
120 source = "registry+https://github.com/rust-lang/crates.io-index"
121 dependencies = [
122 "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
123 "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
124 ]
125
126 [[package]]
127 name = "language-tags"
128 version = "0.2.2"
129 source = "registry+https://github.com/rust-lang/crates.io-index"
130
131 [[package]]
132 name = "lazycell"
133 version = "0.5.1"
134 source = "registry+https://github.com/rust-lang/crates.io-index"
135
136 [[package]]
137 name = "libc"
138 version = "0.2.33"
139 source = "registry+https://github.com/rust-lang/crates.io-index"
140
141 [[package]]
142 name = "libsqlite3-sys"
143 version = "0.9.0"
144 source = "registry+https://github.com/rust-lang/crates.io-index"
145 dependencies = [
146 "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
147 "vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
148 ]
149
150 [[package]]
151 name = "linked-hash-map"
152 version = "0.4.2"
153 source = "registry+https://github.com/rust-lang/crates.io-index"
154
155 [[package]]
156 name = "log"
157 version = "0.3.8"
158 source = "registry+https://github.com/rust-lang/crates.io-index"
159
160 [[package]]
161 name = "lru-cache"
162 version = "0.1.1"
163 source = "registry+https://github.com/rust-lang/crates.io-index"
164 dependencies = [
165 "linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
166 ]
167
168 [[package]]
169 name = "mime"
170 version = "0.3.5"
171 source = "registry+https://github.com/rust-lang/crates.io-index"
172 dependencies = [
173 "unicase 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
174 ]
175
176 [[package]]
177 name = "mio"
178 version = "0.6.11"
179 source = "registry+https://github.com/rust-lang/crates.io-index"
180 dependencies = [
181 "fuchsia-zircon 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
182 "fuchsia-zircon-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
183 "iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
184 "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
185 "lazycell 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
186 "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
187 "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
188 "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
189 "net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
190 "slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
191 "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
192 ]
193
194 [[package]]
195 name = "miow"
196 version = "0.2.1"
197 source = "registry+https://github.com/rust-lang/crates.io-index"
198 dependencies = [
199 "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
200 "net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
201 "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
202 "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
203 ]
204
205 [[package]]
206 name = "mustache"
207 version = "0.8.2"
208 source = "registry+https://github.com/rust-lang/crates.io-index"
209 dependencies = [
210 "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
211 "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
212 ]
213
214 [[package]]
215 name = "net2"
216 version = "0.2.31"
217 source = "registry+https://github.com/rust-lang/crates.io-index"
218 dependencies = [
219 "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
220 "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
221 "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
222 "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
223 "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
224 ]
225
226 [[package]]
227 name = "num_cpus"
228 version = "1.7.0"
229 source = "registry+https://github.com/rust-lang/crates.io-index"
230 dependencies = [
231 "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
232 ]
233
234 [[package]]
235 name = "percent-encoding"
236 version = "1.0.1"
237 source = "registry+https://github.com/rust-lang/crates.io-index"
238
239 [[package]]
240 name = "pkg-config"
241 version = "0.3.9"
242 source = "registry+https://github.com/rust-lang/crates.io-index"
243
244 [[package]]
245 name = "rand"
246 version = "0.3.18"
247 source = "registry+https://github.com/rust-lang/crates.io-index"
248 dependencies = [
249 "fuchsia-zircon 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
250 "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
251 ]
252
253 [[package]]
254 name = "redox_syscall"
255 version = "0.1.31"
256 source = "registry+https://github.com/rust-lang/crates.io-index"
257
258 [[package]]
259 name = "relay"
260 version = "0.1.0"
261 source = "registry+https://github.com/rust-lang/crates.io-index"
262 dependencies = [
263 "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
264 ]
265
266 [[package]]
267 name = "rusqlite"
268 version = "0.13.0"
269 source = "registry+https://github.com/rust-lang/crates.io-index"
270 dependencies = [
271 "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
272 "libsqlite3-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
273 "lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
274 "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
275 ]
276
277 [[package]]
278 name = "rustc-serialize"
279 version = "0.3.24"
280 source = "registry+https://github.com/rust-lang/crates.io-index"
281
282 [[package]]
283 name = "safemem"
284 version = "0.2.0"
285 source = "registry+https://github.com/rust-lang/crates.io-index"
286
287 [[package]]
288 name = "scoped-tls"
289 version = "0.1.0"
290 source = "registry+https://github.com/rust-lang/crates.io-index"
291
292 [[package]]
293 name = "slab"
294 version = "0.3.0"
295 source = "registry+https://github.com/rust-lang/crates.io-index"
296
297 [[package]]
298 name = "slab"
299 version = "0.4.0"
300 source = "registry+https://github.com/rust-lang/crates.io-index"
301
302 [[package]]
303 name = "smallvec"
304 version = "0.2.1"
305 source = "registry+https://github.com/rust-lang/crates.io-index"
306
307 [[package]]
308 name = "take"
309 version = "0.1.0"
310 source = "registry+https://github.com/rust-lang/crates.io-index"
311
312 [[package]]
313 name = "time"
314 version = "0.1.38"
315 source = "registry+https://github.com/rust-lang/crates.io-index"
316 dependencies = [
317 "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
318 "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
319 "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)",
320 "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
321 ]
322
323 [[package]]
324 name = "tokio-core"
325 version = "0.1.10"
326 source = "registry+https://github.com/rust-lang/crates.io-index"
327 dependencies = [
328 "bytes 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
329 "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
330 "iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
331 "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
332 "mio 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
333 "scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
334 "slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
335 "tokio-io 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
336 ]
337
338 [[package]]
339 name = "tokio-io"
340 version = "0.1.4"
341 source = "registry+https://github.com/rust-lang/crates.io-index"
342 dependencies = [
343 "bytes 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
344 "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
345 "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
346 ]
347
348 [[package]]
349 name = "tokio-proto"
350 version = "0.1.1"
351 source = "registry+https://github.com/rust-lang/crates.io-index"
352 dependencies = [
353 "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
354 "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
355 "net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
356 "rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
357 "slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
358 "smallvec 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
359 "take 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
360 "tokio-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
361 "tokio-io 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
362 "tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
363 ]
364
365 [[package]]
366 name = "tokio-service"
367 version = "0.1.0"
368 source = "registry+https://github.com/rust-lang/crates.io-index"
369 dependencies = [
370 "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
371 ]
372
373 [[package]]
374 name = "unicase"
375 version = "2.1.0"
376 source = "registry+https://github.com/rust-lang/crates.io-index"
377 dependencies = [
378 "version_check 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
379 ]
380
381 [[package]]
382 name = "vcpkg"
383 version = "0.2.2"
384 source = "registry+https://github.com/rust-lang/crates.io-index"
385
386 [[package]]
387 name = "version_check"
388 version = "0.1.3"
389 source = "registry+https://github.com/rust-lang/crates.io-index"
390
391 [[package]]
392 name = "winapi"
393 version = "0.2.8"
394 source = "registry+https://github.com/rust-lang/crates.io-index"
395
396 [[package]]
397 name = "winapi-build"
398 version = "0.1.1"
399 source = "registry+https://github.com/rust-lang/crates.io-index"
400
401 [[package]]
402 name = "ws2_32-sys"
403 version = "0.2.1"
404 source = "registry+https://github.com/rust-lang/crates.io-index"
405 dependencies = [
406 "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
407 "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
408 ]
409
410 [metadata]
411 "checksum base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "96434f987501f0ed4eb336a411e0631ecd1afa11574fe148587adc4ff96143c9"
412 "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
413 "checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf"
414 "checksum byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff81738b726f5d099632ceaffe7fb65b90212e8dce59d518729e7e8634032d3d"
415 "checksum bytes 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d828f97b58cc5de3e40c421d0cf2132d6b2da4ee0e11b8632fa838f0f9333ad6"
416 "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"
417 "checksum fuchsia-zircon 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f6c0581a4e363262e52b87f59ee2afe3415361c6ec35e665924eb08afe8ff159"
418 "checksum fuchsia-zircon-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "43f3795b4bae048dc6123a6b972cadde2e676f9ded08aef6bb77f5f157684a82"
419 "checksum futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "118b49cac82e04121117cbd3121ede3147e885627d82c4546b87c702debb90c1"
420 "checksum futures-cpupool 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "e86f49cc0d92fe1b97a5980ec32d56208272cbb00f15044ea9e2799dde766fdf"
421 "checksum httparse 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "af2f2dd97457e8fb1ae7c5a420db346af389926e36f43768b96f101546b04a07"
422 "checksum hyper 0.11.7 (registry+https://github.com/rust-lang/crates.io-index)" = "4959ca95f55df4265bff2ad63066147255e6fa733682cf6d1cb5eaff6e53324b"
423 "checksum iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b6e8b9c2247fcf6c6a1151f1156932be5606c9fd6f55a2d7f9fc1cb29386b2f7"
424 "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
425 "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a"
426 "checksum lazycell 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3b585b7a6811fb03aa10e74b278a0f00f8dd9b45dc681f148bb29fa5cb61859b"
427 "checksum libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "5ba3df4dcb460b9dfbd070d41c94c19209620c191b0340b929ce748a2bcd42d2"
428 "checksum libsqlite3-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1bad50e980f2a86252585f7522a92f17672b1ab5c7087db6a0e566ae6294b8c9"
429 "checksum linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7860ec297f7008ff7a1e3382d7f7e1dcd69efc94751a2284bafc3d013c2aa939"
430 "checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b"
431 "checksum lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4d06ff7ff06f729ce5f4e227876cb88d10bc59cd4ae1e09fbb2bde15c850dc21"
432 "checksum mime 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e2e00e17be181010a91dbfefb01660b17311059dc8c7f48b9017677721e732bd"
433 "checksum mio 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0e8411968194c7b139e9105bc4ae7db0bae232af087147e72f0616ebf5fdb9cb"
434 "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
435 "checksum mustache 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ddb004e419334fc9172d0a5ff91c0770bdd6239091b0b343eb5926101f0a7d13"
436 "checksum net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)" = "3a80f842784ef6c9a958b68b7516bc7e35883c614004dd94959a4dca1b716c09"
437 "checksum num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "514f0d73e64be53ff320680ca671b64fe3fb91da01e1ae2ddc99eb51d453b20d"
438 "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
439 "checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903"
440 "checksum rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)" = "6475140dfd8655aeb72e1fd4b7a1cc1c202be65d71669476e392fe62532b9edd"
441 "checksum redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "8dde11f18c108289bef24469638a04dce49da56084f2d50618b226e47eb04509"
442 "checksum relay 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f301bafeb60867c85170031bdb2fcf24c8041f33aee09e7b116a58d4e9f781c5"
443 "checksum rusqlite 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9409d78a5a9646685688266e1833df8f08b71ffcae1b5db6c1bfb5970d8a80f"
444 "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
445 "checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f"
446 "checksum scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f417c22df063e9450888a7561788e9bd46d3bb3c1466435b4eccb903807f147d"
447 "checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23"
448 "checksum slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fdeff4cd9ecff59ec7e3744cbca73dfe5ac35c2aedb2cfba8a1c715a18912e9d"
449 "checksum smallvec 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c8cbcd6df1e117c2210e13ab5109635ad68a929fcbb8964dc965b76cb5ee013"
450 "checksum take 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b157868d8ac1f56b64604539990685fa7611d8fa9e5476cf0c02cf34d32917c5"
451 "checksum time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)" = "d5d788d3aa77bc0ef3e9621256885555368b47bd495c13dd2e7413c89f845520"
452 "checksum tokio-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "c843a027f7c1df5f81e7734a0df3f67bf329411781ebf36393ce67beef6071e3"
453 "checksum tokio-io 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "514aae203178929dbf03318ad7c683126672d4d96eccb77b29603d33c9e25743"
454 "checksum tokio-proto 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8fbb47ae81353c63c487030659494b295f6cb6576242f907f203473b191b0389"
455 "checksum tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "24da22d077e0f15f55162bdbdc661228c1581892f52074fb242678d015b45162"
456 "checksum unicase 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284b6d3db520d67fbe88fd778c21510d1b0ba4a551e5d0fbb023d33405f6de8a"
457 "checksum vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9e0a7d8bed3178a8fb112199d466eeca9ed09a14ba8ad67718179b4fd5487d0b"
458 "checksum version_check 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6b772017e347561807c1aa192438c5fd74242a670a6cffacc40f2defd1dc069d"
459 "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
460 "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
461 "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
1 [package]
2 name = "cg"
3 version = "0.1.0"
4 authors = ["Getty Ritter <gettylefou@gmail.com>"]
5
6 [dependencies]
7 hyper = "*"
8 rusqlite = "*"
9 time = "*"
10 mustache = "*"
11 futures = "*"
12 # rustc_serialize = "*"
1 use hyper::Error;
2 use std::convert::From;
3 use std::net::AddrParseError;
4
5 #[derive(Debug)]
6 pub enum CGError {
7 Hyper(Error),
8 AddrParse(AddrParseError),
9 SQLite(::rusqlite::Error),
10 }
11
12 impl CGError {
13 pub fn pretty(&self) {
14 match self {
15 &CGError::Hyper(ref err) =>
16 println!("Web server error: {}", err),
17 &CGError::AddrParse(ref err) =>
18 println!("Error parsing address: {}", err),
19 &CGError::SQLite(ref err) =>
20 println!("Error accessing db: {}", err),
21 }
22 }
23 }
24
25 impl From<Error> for CGError {
26 fn from(err: Error) -> Self {
27 CGError::Hyper(err)
28 }
29 }
30
31 impl From<AddrParseError> for CGError {
32 fn from(err: AddrParseError) -> Self {
33 CGError::AddrParse(err)
34 }
35 }
36
37 impl From<::rusqlite::Error> for CGError {
38 fn from(err: ::rusqlite::Error) -> Self {
39 CGError::SQLite(err)
40 }
41 }
1 extern crate futures;
2 extern crate hyper;
3 extern crate rusqlite;
4 extern crate time;
5 extern crate mustache;
6
7 pub mod errors;
8 pub mod model;
9 #[macro_use]
10 pub mod util;
11
12 use futures::future::Future;
13 use hyper::Method;
14 use hyper::header::ContentLength;
15 use hyper::server::{Http, Request, Response, Service};
16
17 struct CG {
18 db: rusqlite::Connection,
19 }
20
21 impl Service for CG {
22 type Request = Request;
23 type Response = Response;
24 type Error = hyper::Error;
25 type Future = Box<Future<Item=Self::Response, Error=Self::Error>>;
26
27 fn call(&self, req: Request) -> Self::Future {
28 util::log_request(&req);
29 let path: Vec<&str> = req.path().split("/").skip(1).collect();
30
31 match (req.method(), path.get(0), path.get(1)) {
32 (&Method::Get, Some(&""), None) => {
33 match model::get_cocktail_list(&self.db) {
34 Ok(ck) => CG::respond(format!("cocktails: {:?}", ck)),
35 Err(err) => {
36 error!("Database problem: {}", err);
37 CG::respond(format!("database problem yo"))
38 }
39 }
40 }
41
42 (&Method::Get, Some(&"favicon.ico"), None) =>
43 CG::respond("icon".to_owned()),
44
45 (&Method::Get, Some(&"cocktail"), Some(name)) =>
46 CG::respond(format!("cocktail {}", name)),
47
48 (&Method::Get, Some(&"tagged"), Some(tag)) =>
49 CG::respond(format!("tag {}", tag)),
50
51 (&Method::Get, Some(&"imgs"), Some(filename)) =>
52 CG::respond(format!("image {}", filename)),
53
54 (_, _, _) => {
55 error!("unknown path: {}", req.path());
56 CG::respond(format!("path not found: {:?}", req.path()))
57
58 }
59 }
60 }
61 }
62
63 impl CG {
64 fn main() -> Result<(), errors::CGError> {
65 let addr = "127.0.0.1:3000".parse()?;
66 let server = Http::new().bind(&addr, || {
67 let db = rusqlite::Connection::open("cocktails.db").unwrap();
68 Ok(CG { db })
69 })?;
70 println!("serving on {:?}", addr);
71 Ok(server.run()?)
72 }
73
74 fn respond(s: String) -> <CG as Service>::Future {
75 Box::new(futures::future::ok(
76 Response::new()
77 .with_header(ContentLength(s.len() as u64))
78 .with_body(s)))
79 }
80
81 }
82
83
84 fn main() {
85 if let Err(err) = CG::main() {
86 err.pretty();
87 std::process::exit(99);
88 }
89 }
1 // extern crate rustc_serialize;
2 use rusqlite::Connection;
3
4 #[derive(Debug, Clone)]
5 pub struct Cocktail {
6 pub name: String,
7 pub image: String,
8 pub created: String, // ::time::Timespec,
9
10 pub tags: Vec<String>,
11 pub ingredients: Vec<Ingredient>,
12 }
13
14 #[derive(Debug, Clone)]
15 pub struct Ingredient {
16 pub name: String,
17 pub amount: String,
18 }
19
20 pub fn get_cocktail_list(conn: &Connection) ->
21 Result<Vec<Cocktail>, ::rusqlite::Error>
22 {
23 let mut stmt = conn.prepare(
24 "SELECT id, name, image, created FROM Cocktail ORDER BY created DESC")?;
25
26 let cocktails: Result<Vec<(i64, Cocktail)>, ::rusqlite::Error> =
27 stmt.query_and_then(&[], |row| {
28 Ok((row.get_checked(0)?,
29 Cocktail {
30 name: row.get_checked(1)?,
31 image: row.get_checked(2)?,
32 created: row.get_checked(3)?,
33
34 ingredients: vec![],
35 tags: vec![],
36 }))
37 })?.collect();
38
39 let cocktails: Result<Vec<Cocktail>, ::rusqlite::Error> =
40 cocktails?.iter().map(|&(id, ref c)| {
41 let mut c = c.clone();
42 let mut tag_stmt = conn.prepare(
43 "SELECT name FROM Tag WHERE cocktail_id = ?")?;
44 let tags: Result<Vec<String>, ::rusqlite::Error> =
45 tag_stmt.query_and_then(&[&id], |row| {
46 row.get_checked(0)
47 })?.collect();
48 c.tags = tags?;
49 Ok(c)
50 }).collect();
51 Ok(cocktails?)
52 }
1 use hyper::{Method,Request};
2
3 pub fn log_request(req: &Request) {
4 let color = match req.method() {
5 &Method::Get => "\x1b[92m",
6 &Method::Post => "\x1b[93m",
7 &Method::Put => "\x1b[94m",
8 &Method::Head => "\x1b[95m",
9 _ => "",
10 };
11
12 println!("{}[{}]: {:?} {:?} (from {:?})\x1b[39m",
13 color,
14 ::time::now().rfc3339(),
15 req.method(),
16 req.path(),
17 req.remote_addr(),
18 );
19 }
20
21 pub fn log_error(msg: String) {
22 println!(
23 "\x1b[91m[{}]: {}\x1b[39m",
24 ::time::now().rfc3339(),
25 msg);
26 }
27
28 macro_rules! error {
29 ($fmt:expr) => { ::util::log_error(format!($fmt)) };
30 ($fmt:expr, $( $args:expr ),*) => {
31 ::util::log_error(format!($fmt, $( $args ),*)) }
32 }