Skip to content

Latest commit

 

History

History
59 lines (46 loc) · 1.59 KB

README.md

File metadata and controls

59 lines (46 loc) · 1.59 KB

back to hoodie-account-server

hapi CouchDB Account Routes

See the shiny docs at http://docs.accountjsonapi.apiary.io/. Comment / send PRs for apiary.apib.

All routes at a glance

# sign in, check session, sign out
PUT /session
GET /session
DELETE /session

# sign up, get / update / destroy account
# non-admins only
PUT /session/account
GET /session/account
PATCH /session/account
DELETE /session/account

# get / update profile
# non-admins only
GET /session/account/profile
PATCH /session/account/profile

# requests (e.g. password resets / username reminder, user account confirmation)
POST /requests
GET /requests # admins only
GET /requests/{id}
DELETE /requests/{id}

# admins only: manage accounts
POST /accounts
GET /accounts
GET /accounts/{username}
PATCH /accounts/{username}
DELETE /accounts/{username}

The route groups are implemented as hapi plugins themselves.

The options passed to the routes plugins are the same as the ones passed to the main plugin.

Notes on CouchDB Admin accounts

CouchDB admins do not require _users docs, which that plugin requires, as it stores user IDs in a special id:<userId here> role. Because of that, the /session/account & /session/account/profile routes are forbidden for admins. And even if an admin account has a _users doc, it will not be returned by the /accounts API for consistency reasons.