diff --git a/README.md b/README.md index d05f7b0..9fa8dc0 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ -REST: N2O separate endpoint -=========================== +REST: framework with typed JSON +=============================== Usage ----- +Just plug REST endpoint directly to your Cowboy router: + ```erlang {"/rest/:resource", rest_cowboy, []}, {"/rest/:resource/:id", rest_cowboy, []}, @@ -12,6 +14,8 @@ Usage Module ------ +Sample REST service implementation: + ```erlang -module(users). -behaviour(rest). @@ -30,3 +34,19 @@ post(#user{} = User) -> ets:insert(users, User); post(Data) -> post(from_json(Data, #user{})). ``` +Usage +----- + + curl -i -X POST -d "id=vlad" localhost:8000/rest/users + curl -i -X POST -d "id=doxtop" localhost:8000/rest/users + curl -i -X GET localhost:8000/rest/users + curl -i -X PUT -d "id=5HT" localhost:8000/rest/users/vlad + curl -i -X GET localhost:8000/rest/users/5HT + curl -i -X DELETE localhost:8000/rest/users/5HT + +Credits +------- + +* Dmitry Bushmelev + +OM A HUM diff --git a/src/rest.app.src b/src/rest.app.src index ee2a8ff..f36835a 100644 --- a/src/rest.app.src +++ b/src/rest.app.src @@ -1,7 +1,7 @@ {application, rest, [ {description, "REST SXC"}, {vsn, "3.0"}, - {applications, [kernel, stdlib, cowboy, ranch, gproc, mimetypes, erlydtl]}, + {applications, [kernel, stdlib, cowboy]}, {modules, []}, {registered, []}, {mod, { rest_app, []}},