Skip to content
This repository has been archived by the owner on Nov 3, 2018. It is now read-only.

Commit

Permalink
More auth work
Browse files Browse the repository at this point in the history
  • Loading branch information
Eran Hammer committed Nov 4, 2012
1 parent 07a9c9c commit ea6597d
Show file tree
Hide file tree
Showing 16 changed files with 220 additions and 828 deletions.
4 changes: 2 additions & 2 deletions api/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ Db.initialize(true, function (err) {

{
name: 'postmile.web',
scope: { authorized: true, login: true, reminder: true, signup: true, tos: true },
scope: ['authorized', 'login', 'reminder', 'signup', 'tos'],
secret: Hapi.Session.getRandomString(64)
},

{
name: 'postmile.view',
scope: {}
scope: []
}
];

Expand Down
2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Eran Hammer <eran@hueniverse.com>",
"private": true,
"dependencies": {
"hapi": "0.7.x",
"hapi": "0.9.x",
"mongodb": "0.9.x",
"oauth": "0.9.x",
"socket.io": "0.8.x",
Expand Down
85 changes: 41 additions & 44 deletions api/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// Load modules

var Hapi = require('hapi');
var Batch = require('./batch');
var Details = require('./details');
var Invite = require('./invite');
var Last = require('./last');
Expand All @@ -24,7 +23,7 @@ var User = require('./user');

exports.endpoints = [

{ method: 'GET', path: '/oauth/client/:id', config: Session.client },
{ method: 'GET', path: '/oauth/client/{id}', config: Session.client },

{ method: 'GET', path: '/profile', config: User.get },
{ method: 'POST', path: '/profile', config: User.post },
Expand All @@ -33,52 +32,50 @@ exports.endpoints = [
{ method: 'GET', path: '/who', config: User.who },

{ method: 'PUT', path: '/user', config: User.put },
{ method: 'POST', path: '/user/:id/tos/:version', config: User.tos },
{ method: 'POST', path: '/user/:id/link/:network', config: User.link },
{ method: 'DELETE', path: '/user/:id/link/:network', config: User.unlink },
{ method: 'POST', path: '/user/:id/view/:path', config: User.view },
{ method: 'GET', path: '/user/lookup/:type/:id', config: User.lookup },
{ method: 'POST', path: '/user/{id}/tos/{version}', config: User.tos },
{ method: 'POST', path: '/user/{id}/link/{network}', config: User.link },
{ method: 'DELETE', path: '/user/{id}/link/{network}', config: User.unlink },
{ method: 'POST', path: '/user/{id}/view/{path}', config: User.view },
{ method: 'GET', path: '/user/lookup/{type}/{id}', config: User.lookup },
{ method: 'POST', path: '/user/reminder', config: User.reminder },
{ method: 'DELETE', path: '/user', config: User.del },

{ method: 'GET', path: '/projects', config: Project.list },
{ method: 'GET', path: '/project/:id', config: Project.get },
{ method: 'POST', path: '/project/:id', config: Project.post },
{ method: 'GET', path: '/project/{id}', config: Project.get },
{ method: 'POST', path: '/project/{id}', config: Project.post },
{ method: 'PUT', path: '/project', config: Project.put },
{ method: 'DELETE', path: '/project/:id', config: Project.del },
{ method: 'GET', path: '/project/:id/tips', config: Project.tips },
{ method: 'GET', path: '/project/:id/suggestions', config: Project.suggestions },
{ method: 'POST', path: '/project/:id/participants', config: Project.participants },
{ method: 'DELETE', path: '/project/:id/participants', config: Project.uninvite },
{ method: 'DELETE', path: '/project/:id/participant/:user', config: Project.uninvite },
{ method: 'POST', path: '/project/:id/join', config: Project.join },

{ method: 'GET', path: '/project/:id/tasks', config: Task.list },
{ method: 'GET', path: '/task/:id', config: Task.get },
{ method: 'POST', path: '/task/:id', config: Task.post },
{ method: 'PUT', path: '/project/:id/task', config: Task.put },
{ method: 'DELETE', path: '/task/:id', config: Task.del },

{ method: 'GET', path: '/task/:id/details', config: Details.get },
{ method: 'POST', path: '/task/:id/detail', config: Details.post },

{ method: 'DELETE', path: '/project/:id/suggestion/:drop', config: Suggestions.exclude },

{ method: 'GET', path: '/project/:id/last', config: Last.getProject },
{ method: 'POST', path: '/project/:id/last', config: Last.postProject },
{ method: 'GET', path: '/task/:id/last', config: Last.getTask },
{ method: 'POST', path: '/task/:id/last', config: Last.postTask },

{ method: 'GET', path: '/storage/:id?', config: Storage.get },
{ method: 'POST', path: '/storage/:id', config: Storage.post },
{ method: 'DELETE', path: '/storage/:id', config: Storage.del },

{ method: 'GET', path: '/invite/:id', config: Invite.get },
{ method: 'POST', path: '/invite/:id/claim', config: Invite.claim },

{ method: 'POST', path: '/stream/:id/project/:project', config: Stream.subscribe },
{ method: 'DELETE', path: '/stream/:id/project/:project', config: Stream.unsubscribe },

{ method: 'POST', path: '/batch', config: Batch.post }
{ method: 'DELETE', path: '/project/{id}', config: Project.del },
{ method: 'GET', path: '/project/{id}/tips', config: Project.tips },
{ method: 'GET', path: '/project/{id}/suggestions', config: Project.suggestions },
{ method: 'POST', path: '/project/{id}/participants', config: Project.participants },
{ method: 'DELETE', path: '/project/{id}/participants', config: Project.uninvite },
{ method: 'DELETE', path: '/project/{id}/participant/{user}', config: Project.uninvite },
{ method: 'POST', path: '/project/{id}/join', config: Project.join },

{ method: 'GET', path: '/project/{id}/tasks', config: Task.list },
{ method: 'GET', path: '/task/{id}', config: Task.get },
{ method: 'POST', path: '/task/{id}', config: Task.post },
{ method: 'PUT', path: '/project/{id}/task', config: Task.put },
{ method: 'DELETE', path: '/task/{id}', config: Task.del },

{ method: 'GET', path: '/task/{id}/details', config: Details.get },
{ method: 'POST', path: '/task/{id}/detail', config: Details.post },

{ method: 'DELETE', path: '/project/{id}/suggestion/{drop}', config: Suggestions.exclude },

{ method: 'GET', path: '/project/{id}/last', config: Last.getProject },
{ method: 'POST', path: '/project/{id}/last', config: Last.postProject },
{ method: 'GET', path: '/task/{id}/last', config: Last.getTask },
{ method: 'POST', path: '/task/{id}/last', config: Last.postTask },

{ method: 'GET', path: '/storage/{id?}', config: Storage.get },
{ method: 'POST', path: '/storage/{id}', config: Storage.post },
{ method: 'DELETE', path: '/storage/{id}', config: Storage.del },

{ method: 'GET', path: '/invite/{id}', config: Invite.get },
{ method: 'POST', path: '/invite/{id}/claim', config: Invite.claim },

{ method: 'POST', path: '/stream/{id}/project/{project}', config: Stream.subscribe },
{ method: 'DELETE', path: '/stream/{id}/project/{project}', config: Stream.unsubscribe }
];

Loading

0 comments on commit ea6597d

Please sign in to comment.