Skip to content

Commit

Permalink
Create client in web app.
Browse files Browse the repository at this point in the history
Signed-off-by: François de Metz <fdemetz@af83.com>
  • Loading branch information
francois2metz committed Apr 14, 2011
1 parent c7acfc8 commit 907084e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -110,6 +110,10 @@ A [wiki page](https://github.com/AF83/auth_server/wiki/Uses) lists the projects

GET /clients

### Create client

POST /client

### Update client

POST /client
Expand Down
15 changes: 15 additions & 0 deletions src/middlewares/web_app.js
Expand Up @@ -28,6 +28,20 @@ function listClients(req, res) {
})+"]");
});
}
/**
* Create Client
*/
function createClient(req, res) {
var client = new model.Client(req.body);
client.save(function(err) {
if (err) {
res.writeHead(500, {'Content-Type': 'text/plain'});
return res.end(err.toString());
}
res.writeHead(200);
res.end();
});
}
/**
* Update Client
*/
Expand Down Expand Up @@ -96,6 +110,7 @@ exports.connector = function(oauth2_client) {
}
addRoute('get', '/', index);
addRoute('get', '/clients', listClients);
addRoute('post', '/client', createClient);
addRoute('put', '/client', updateClient);
addRoute('get', '/users', listUsers);
});
Expand Down

0 comments on commit 907084e

Please sign in to comment.