diff --git a/.changeset/dispatchit-express-adapter.md b/.changeset/dispatchit-express-adapter.md deleted file mode 100644 index 1bc6d2f..0000000 --- a/.changeset/dispatchit-express-adapter.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -'dispatchit': minor ---- - -Adds an Express adapter. Import `dispatchitExpress` from `dispatchit/adapters/express` and mount it on any Express 4 or 5 app. - -Because Express parses the request body before your middleware runs, the adapter needs the raw body to verify signatures. Capture it with a verify hook when you configure `express.json`, then mount the adapter after it: - -```ts -app.use( - '/api/webhooks/dispatchit', - express.json({ - verify: (req, res, buf) => { - ;(req as DispatchitRequest).rawBody = buf - }, - }), - dispatchitExpress(config) -) -``` diff --git a/packages/dispatchit/CHANGELOG.md b/packages/dispatchit/CHANGELOG.md new file mode 100644 index 0000000..2f698d3 --- /dev/null +++ b/packages/dispatchit/CHANGELOG.md @@ -0,0 +1,21 @@ +# dispatchit + +## 1.1.0 + +### Minor Changes + +- [#1](https://github.com/webamboos/dispatchit-sdk/pull/1) [`9411a15`](https://github.com/webamboos/dispatchit-sdk/commit/9411a15aad4df60c9cc3cc0b81e387d6e6eeb005) Thanks [@arpadgabor](https://github.com/arpadgabor)! - Adds an Express adapter. Import `dispatchitExpress` from `dispatchit/adapters/express` and mount it on any Express 4 or 5 app. + + Because Express parses the request body before your middleware runs, the adapter needs the raw body to verify signatures. Capture it with a verify hook when you configure `express.json`, then mount the adapter after it: + + ```ts + app.use( + '/api/webhooks/dispatchit', + express.json({ + verify: (req, res, buf) => { + ;(req as DispatchitRequest).rawBody = buf + }, + }), + dispatchitExpress(config) + ) + ``` diff --git a/packages/dispatchit/package.json b/packages/dispatchit/package.json index aa62136..ec55823 100644 --- a/packages/dispatchit/package.json +++ b/packages/dispatchit/package.json @@ -1,6 +1,6 @@ { "name": "dispatchit", - "version": "1.0.0", + "version": "1.1.0", "description": "Framework-agnostic SDK for building Dispatchit webhook endpoints.", "license": "MIT", "repository": {