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

Use the new json module for the file_server example

This commit is contained in:
Loïc Hoguin 2025-02-11 16:56:30 +01:00
parent 761c1f8dca
commit 65a77a8f48
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764
2 changed files with 2 additions and 2 deletions

View file

@ -2,7 +2,7 @@ PROJECT = file_server
PROJECT_DESCRIPTION = Cowboy file server example with directory listing
PROJECT_VERSION = 1
DEPS = cowboy jsx
DEPS = cowboy
dep_cowboy_commit = master
REL_DEPS = relx

View file

@ -37,7 +37,7 @@ charsets_provided(Req, State) ->
list_json(Req, {Path, Fs}) ->
Files = [unicode:characters_to_binary(F) || F <- Fs],
{jsx:encode(Files), Req, Path}.
{json:encode(Files), Req, Path}.
list_html(Req, {Path, Fs}) ->
Body = [[links(Path, unicode:characters_to_binary(F)) || F <- [".."|Fs]]],