mirror of
https://github.com/jambonz/jambonz-node.git
synced 2026-01-25 02:08:15 +00:00
allow 202 response to PUT
This commit is contained in:
@@ -2,10 +2,12 @@
|
||||
|
||||
A Node.js SDK for the open source [jambonz](docs.jambonz.org) CPaaS platform. Node.js applications can use this library to respond to [jambonz webhooks](https://docs.jambonz.org/jambonz/) and to make [REST API calls](https://docs.jambonz.org/rest/) to a jambonz platform.
|
||||
|
||||
> Note: One suggested way to get up and running with this Node SDK is to use the `npx create-jambonz-app` command, which will scaffold out a jambonz application for you using this SDK.
|
||||
|
||||
### Webooks
|
||||
To respond to webhooks, you will need a lightweight http server. An example is shown below using [express](expressjs.com).
|
||||
```
|
||||
const WebhookResponse = require('@jambonz/node-client').WebhookResponse;
|
||||
const {WebhookResponse} = require('@jambonz/node-client');
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class Jambonz {
|
||||
const headers = {'Authorization': `Bearer ${apiKey}`};
|
||||
|
||||
const post = bent(baseUrl, 'POST', 'json', headers, 201);
|
||||
const put = bent(baseUrl, 'PUT', headers, 204);
|
||||
const put = bent(baseUrl, 'PUT', headers, 202, 204);
|
||||
const get = bent(baseUrl, 'GET', 'json', headers, 200);
|
||||
const del = bent(baseUrl, 'DELETE', headers, 204);
|
||||
|
||||
|
||||
2857
package-lock.json
generated
2857
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "@jambonz/node-client",
|
||||
"version": "0.2.1",
|
||||
"version": "0.2.2",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
"test": "NODE_ENV=test node test/ | ./node_modules/.bin/tap-spec",
|
||||
"test": "NODE_ENV=test node test/ ",
|
||||
"coverage": "./node_modules/.bin/nyc --reporter html --report-dir ./coverage npm run test",
|
||||
"jslint": "eslint lib"
|
||||
},
|
||||
@@ -22,7 +22,6 @@
|
||||
"nyc": "^15.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tap-spec": "^5.0.0",
|
||||
"tape": "^5.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user