No, JSON is not needed here.

For this simple blogging platform, let's start simple, basic
HTML forms are enough.
main
absc 2024-08-02 23:40:55 +02:00
parent 33cc07914d
commit 631f729ed9
2 changed files with 3 additions and 3 deletions

View File

@ -37,7 +37,7 @@ start(_Type, StartArgs) ->
Dispatch = cowboy_router:compile([ Dispatch = cowboy_router:compile([
{'_', [ {'_', [
{"/user", dudeswave_user_handler, #{bucket => ?USERSBUCKET}}, {"/user/new", dudeswave_user_handler, #{bucket => ?USERSBUCKET}},
{"/", dudeswave_handler, #{bucket => ?APPBUCKET}} {"/", dudeswave_handler, #{bucket => ?APPBUCKET}}
]} ]}
]), ]),

View File

@ -45,10 +45,10 @@ allowed_methods(Req, State) ->
{[<<"PUT">>], Req, State}. {[<<"PUT">>], Req, State}.
content_types_accepted(Req, State) -> content_types_accepted(Req, State) ->
{[{{ <<"application">>, <<"json">>, '*'}, create_user}], Req, State}. {[{<<"application/x-www-form-urlencoded">>, create_user}], Req, State}.
known_methods(Req, State) -> known_methods(Req, State) ->
{[<<"PUT">>], Req, State}. {[<<"POST">>], Req, State}.
resource_exists(Req, State) -> resource_exists(Req, State) ->
{ok, Bucket} = maps:find(bucket, State), {ok, Bucket} = maps:find(bucket, State),