Browse Source

Merge branch 'master' of https://github.com/synrc/rest

Maxim Sokhatsky 11 years ago
parent
commit
1c091ab7c3
2 changed files with 23 additions and 3 deletions
  1. 22 2
      README.md
  2. 1 1
      src/rest.app.src

+ 22 - 2
README.md

@@ -1,9 +1,11 @@
-REST: N2O separate endpoint
-===========================
+REST: framework with typed JSON
+===============================
 
 
 Usage
 Usage
 -----
 -----
 
 
+Just plug REST endpoint directly to your Cowboy router:
+
 ```erlang
 ```erlang
 {"/rest/:resource", rest_cowboy, []},
 {"/rest/:resource", rest_cowboy, []},
 {"/rest/:resource/:id", rest_cowboy, []},
 {"/rest/:resource/:id", rest_cowboy, []},
@@ -12,6 +14,8 @@ Usage
 Module
 Module
 ------
 ------
 
 
+Sample REST service implementation:
+
 ```erlang
 ```erlang
 -module(users).
 -module(users).
 -behaviour(rest).
 -behaviour(rest).
@@ -30,3 +34,19 @@ post(#user{} = User) -> ets:insert(users, User);
 post(Data) -> post(from_json(Data, #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

+ 1 - 1
src/rest.app.src

@@ -1,7 +1,7 @@
 {application, rest, [
 {application, rest, [
     {description,  "REST SXC"},
     {description,  "REST SXC"},
     {vsn,          "3.0"},
     {vsn,          "3.0"},
-    {applications, [kernel, stdlib, cowboy, ranch, gproc, mimetypes, erlydtl]},
+    {applications, [kernel, stdlib, cowboy]},
     {modules, []},
     {modules, []},
     {registered,   []},
     {registered,   []},
     {mod, { rest_app, []}},
     {mod, { rest_app, []}},