Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
@kjots/express-json-data
Advanced tools
A JSON data object Express router with PATCH support.
npm install --save @kjots/express-json-data
import express from 'express';
import expressJsonData from '@kjots/express-json-data';
let data = {};
let app = express()
.use('/data', expressJsonData({ data }));
var express = require('express');
var expressJsonData = require('@kjots/express-json-data').default;
var data = {};
var app = express()
.use('/data', expressJsonData({ data: data }));
Create an Express JSON Data router with the provided options.
Type: Object
Default: {}
The data object upon which the Express JSON Data router will operate.
Type: Number
or String
The maximum body size for PUT
, POST
and PATCH
requests.
The limit value is passed directly to bodyParser.json() without modification.
Type: String
or Array<String>
or Function<String, Boolean>
Default: [ 'application/json', 'application/json-patch+json' ]
The supported media types for PUT
, POST
and PATCH
requests.
The type value is passed directly to bodyParser.json() without modification.
All of the following HTTP methods may be used with the base URI (e.g. /data
) or with any path beneath the base URI
(e.g. /data/path/to/value
).
If the base URI is used, the HTTP request will operate on the entire data object.
If a path beneath the base URI is used, the request path will be treated as a JSON Pointer to a value within the data object, and the HTTP request will operate on that value only.
Return the current value of the data object or request path value.
Replace the contents of the data object or request path value with the request body.
This method will return the updated value of the data object or request path value.
Merge the request body into contents of the data object or request path value.
This method uses the _.merge
method from lodash to merge the
data, with the request body as the source object.
This method will return the updated value of the data object or request path value.
Apply the request body as a JSON Patch to the data object or request path value.
This method will accept either an Array
of JSON patch operations or an Object
containing a single JSON patch
operation.
This method will return the updated value of the data object or request path value.
Clear the contents of the data object, or remove the request path value from the data object.
FAQs
Express JSON data router
The npm package @kjots/express-json-data receives a total of 1 weekly downloads. As such, @kjots/express-json-data popularity was classified as not popular.
We found that @kjots/express-json-data demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.