mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 04:10:24 +00:00
Use the new json module for the file_server example
This commit is contained in:
parent
761c1f8dca
commit
65a77a8f48
2 changed files with 2 additions and 2 deletions
|
@ -2,7 +2,7 @@ PROJECT = file_server
|
||||||
PROJECT_DESCRIPTION = Cowboy file server example with directory listing
|
PROJECT_DESCRIPTION = Cowboy file server example with directory listing
|
||||||
PROJECT_VERSION = 1
|
PROJECT_VERSION = 1
|
||||||
|
|
||||||
DEPS = cowboy jsx
|
DEPS = cowboy
|
||||||
dep_cowboy_commit = master
|
dep_cowboy_commit = master
|
||||||
|
|
||||||
REL_DEPS = relx
|
REL_DEPS = relx
|
||||||
|
|
|
@ -37,7 +37,7 @@ charsets_provided(Req, State) ->
|
||||||
|
|
||||||
list_json(Req, {Path, Fs}) ->
|
list_json(Req, {Path, Fs}) ->
|
||||||
Files = [unicode:characters_to_binary(F) || F <- Fs],
|
Files = [unicode:characters_to_binary(F) || F <- Fs],
|
||||||
{jsx:encode(Files), Req, Path}.
|
{json:encode(Files), Req, Path}.
|
||||||
|
|
||||||
list_html(Req, {Path, Fs}) ->
|
list_html(Req, {Path, Fs}) ->
|
||||||
Body = [[links(Path, unicode:characters_to_binary(F)) || F <- [".."|Fs]]],
|
Body = [[links(Path, unicode:characters_to_binary(F)) || F <- [".."|Fs]]],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue