No, JSON is not needed here.
For this simple blogging platform, let's start simple, basic HTML forms are enough.main
parent
33cc07914d
commit
631f729ed9
|
@ -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}}
|
||||||
]}
|
]}
|
||||||
]),
|
]),
|
||||||
|
|
|
@ -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),
|
||||||
|
|
Loading…
Reference in New Issue