Update API.md

This commit is contained in:
AJ ONeal 2017-08-02 18:11:48 -06:00
parent 9a0222c991
commit 7b9a48338c
1 changed files with 16 additions and 4 deletions

20
API.md
View File

@ -147,16 +147,28 @@ module.exports.create = function (conf, deps, app) {
```
Special methods for `app`:
--------------------------
### app.handlePromise(request, response, promise, message);
`handlePromise` will respond to the request with the result of `promise` as JSON.
If there is an error, it will include `message` in order to help you debug.
```
req.apiUrlPrefix => https://api.example.com/api/tld.domain.pkg
req.experienceId // the example.com part of https://example.com/foo (or example.com#foo if /foo is part of the app name)
req.clientApiUri // the api.example.com part of https://api.example.com/api/com.example.hello/kv/foo
Special properties of `request`:
--------------------------------
```js
req.apiUrlPrefix // This represents the full package path
// without any package specific endpoints
// i.e. https://api.example.com/api/tld.domain.pkg
req.experienceId // The instance name of an app as a whole, where an app is mounted
// i.e. the 'example.com' part of https://example.com/foo
// OR 'example.com#foo' if '/foo' is part of the app's mount point
req.clientApiUri // The api URL for the instance of an app
// the 'api.example.com' part of https://api.example.com/api/com.example.hello/kv/foo
req.pkgId // the com.example.hello part of https://api.example.com/api/com.example.hello/kv/foo
req.getSiteStore().then(function (models) {