0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 20:30:23 +00:00

Simplify example instructions and fix broken examples

Also convert to AsciiDoc while we're at it.
This commit is contained in:
Loïc Hoguin 2016-01-14 20:00:50 +01:00
parent 4023e7f4e4
commit 394b4f0bf7
28 changed files with 246 additions and 388 deletions

View file

@ -16,7 +16,7 @@
-export([paste_text/2]).
init(Req, Opts) ->
random:seed(now()),
random:seed(os:timestamp()),
{cowboy_rest, Req, Opts}.
allowed_methods(Req, State) ->
@ -57,13 +57,13 @@ create_paste(Req, State) ->
paste_html(Req, index) ->
{read_file("index.html"), Req, index};
paste_html(Req, Paste) ->
#{lang := Lang} = cowboy_req:match_qs([lang], Req),
#{lang := Lang} = cowboy_req:match_qs([{lang, [], plain}], Req),
{format_html(Paste, Lang), Req, Paste}.
paste_text(Req, index) ->
{read_file("index.txt"), Req, index};
paste_text(Req, Paste) ->
#{lang := Lang} = cowboy_req:match_qs([lang], Req),
#{lang := Lang} = cowboy_req:match_qs([{lang, [], plain}], Req),
{format_text(Paste, Lang), Req, Paste}.
% Private