This repository has been archived by the owner on Sep 25, 2024. It is now read-only.
directus-extension-raw-body 0.0.1-ci-test-3
Install from the command line:
Learn more about npm packages
$ npm install @significa/directus-extension-raw-body@0.0.1-ci-test-3
Install via package.json:
"@significa/directus-extension-raw-body": "0.0.1-ci-test-3"
About this version
Simple Directus extension that sets the serialized request body in the express request object.
In your Directus project directory run:
npm install directus-extension-raw-body
Create an environment variable RAW_BODY_ENDPOINT_PATTERN
with a Regex Expression matching the
endpoints/routes where rawBody
will be added to the request object.
Examples:
# Matches all endpoints for a specific extension
RAW_BODY_ENDPOINT_PATTERN='^\/sample-extension\/.*$'
# Matches all endpoints (not recommended)
RAW_BODY_ENDPOINT_PATTERN='*'
# Matches two routes /hello-world and /sample/path
RAW_BODY_ENDPOINT_PATTERN='^(\/hello-world|\/sample\/path)$'
Restart Directus for the changes to take effect.
Create a directus endpoint extension:
-
JS
export default (router, _) => { router.post( '/sample', async (req, res, _next) => { console.log('Raw body:', req.rawBody) return res.json({ status: 'OK', raw_body: req.rawBody, }) } )
-
TS
export default (router, _) => { router.post( '/sample', async (req: RequestWithRawBody, res: ServerResponse, _next) => { console.log('Raw body:', req.rawBody) return res.json({ status: 'OK', raw_body: req.rawBody, }) } )
Details
- directus-extension-raw-body
- significa
- about 2 years ago
- 5 dependencies
Assets
- directus-extension-raw-body-0.0.1-ci-test-3.tgz
Download activity
- Total downloads 0
- Last 30 days 0
- Last week 0
- Today 0