Debian Codegraph @

examples/rest_pastebin/README.asciidoc

raw
1 = REST pastebin example
2
3 To try this example, you need GNU `make` and `git` in your PATH.
4
5 To build and run the example, use the following command:
6
7 [source,bash]
8 $ make run
9
10 Then point your browser to http://localhost:8080
11
12 == Usage
13
14 To upload something to the paste application, you can use `curl`:
15
16 [source,bash]
17 $ <command> | curl -i --data-urlencode paste@- localhost:8080
18
19 Or, to upload the file `my_file`:
20
21 [source,bash]
22 curl -i --data-urlencode paste@my_file localhost:8080
23
24 The URL of your data will be in the location header. Alternately, you can visit
25 http://localhost:8080 with your favorite web browser and submit your paste via
26 the form.
27
28 Code that has been pasted can be highlighted with ?lang=<language> option if
29 you have http://www.andre-simon.de/doku/highlight/en/highlight.html[highlight]
30 installed (although `pygments` or any other should work just fine).
31
32 This will show the contents of the HTML file:
33
34 [source,bash]
35 curl -i --data-urlencode paste@priv/index.html localhost:8080
36 curl <url from location header>
37
38 If your terminal supports color sequences and `highlight` is installed,
39 the following command will show the same contents but with HTML syntax
40 highlighting.
41
42 [source,bash]
43 curl <url from location header>?lang=html
44
45 If you open the same URL in your web browser and your web browser tells
46 Cowboy that it prefers HTML files, you will see the file highlighted
47 with special HTML markup and CSS. Firefox is known to work.