1 | [back to hoodie-account-server](../README.md)
|
2 |
|
3 | # hapi CouchDB Account Routes
|
4 |
|
5 | See the shiny docs at http://docs.accountjsonapi.apiary.io/.
|
6 | Comment / send PRs for [apiary.apib](https://github.com/hoodiehq/account-json-api/blob/master/apiary.apib).
|
7 |
|
8 | All routes at a glance
|
9 |
|
10 | ```
|
11 | # sign in, check session, sign out
|
12 | PUT /session
|
13 | GET /session
|
14 | DELETE /session
|
15 |
|
16 | # sign up, get / update / destroy account
|
17 | # non-admins only
|
18 | PUT /session/account
|
19 | GET /session/account
|
20 | PATCH /session/account
|
21 | DELETE /session/account
|
22 |
|
23 | # get / update profile
|
24 | # non-admins only
|
25 | GET /session/account/profile
|
26 | PATCH /session/account/profile
|
27 |
|
28 | # requests (e.g. password resets / username reminder, user account confirmation)
|
29 | POST /requests
|
30 | GET /requests # admins only
|
31 | GET /requests/{id}
|
32 | DELETE /requests/{id}
|
33 |
|
34 | # admins only: manage accounts
|
35 | POST /accounts
|
36 | GET /accounts
|
37 | GET /accounts/{username}
|
38 | PATCH /accounts/{username}
|
39 | DELETE /accounts/{username}
|
40 | ```
|
41 |
|
42 | The route groups are implemented as hapi plugins themselves.
|
43 |
|
44 | - [session.js](session.js)
|
45 | - [account.js](account.js)
|
46 | - [profile.js](profile.js)
|
47 | - [requests.js](requests.js)
|
48 | - [accounts.js](accounts.js)
|
49 |
|
50 | The options passed to the routes plugins are the same as the ones passed to the
|
51 | [main plugin](../plugin/README.md).
|
52 |
|
53 | ## Notes on CouchDB Admin accounts
|
54 |
|
55 | CouchDB admins do not require `_users` docs, which that plugin requires, as it
|
56 | stores user IDs in a special `id:<userId here>` role. Because of that, the
|
57 | `/session/account` & `/session/account/profile` routes are forbidden for admins.
|
58 | And even if an admin account has a `_users` doc, it will not be returned by the
|
59 | `/accounts` API for consistency reasons.
|