
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
node-document-api
Advanced tools

HTTP API endpoint/middleware for node-document ODM for Node.js.
Unified HTTP API for write/read data to/from differen kinds of storages/databases.
POST(:route)/:type/:id
HTTP POST /post/1
{
"title": "Post 1",
"description": "Lorem ipsum..."
}
/*
200 OK
*/
[
{
"_type": "post",
"_id": 1,
"title": "Post 1",
"description": "Lorem ipsum..."
}
]
(:route)/:type/:id,...,:id
HTTP POST /post/1,2,3
[
{
"title": "Post 1",
"description": "Lorem ipsum..."
},
{
"title": "Post 2",
"description": "Lorem ipsum..."
},
{
"title": "Post 3",
"description": "Lorem ipsum..."
}
]
/*
200 OK
*/
[
true,
true,
true
]
PUT(:route)/:type/:id
HTTP PUT /post/1
{
"title": "Post 1",
"description": "Lorem ipsum...",
"extra": true
}
/*
200 OK
*/
[
{
"_type": "post",
"_id": 1,
"title": "Post 1",
"description": "Lorem ipsum...",
"extra": true
}
]
(:route)/:type/:id,...,:id
HTTP PUT /post/1,2,3
[
{
"title": "Post 1",
"description": "Lorem ipsum...",
"extra": true
},
{
"title": "Post 2",
"description": "Lorem ipsum...",
"extra": true
},
{
"title": "Post 3",
"description": "Lorem ipsum...",
"extra": true
}
]
/*
200 OK
*/
[
true,
true,
true
]
GET(:route)/:type/:id
HTTP GET /post/1
/*
200 OK
*/
[
{
"_type": "post",
"_id": 1,
"title": "Post 1",
"description": "Lorem ipsum..."
}
]
(:route)/:type/:id,...,:id
HTTP GET /post/1,2,3
/*
200 OK
*/
[
{
"_type": "post",
"_id": 1,
"title": "Post 1",
"description": "Lorem ipsum..."
},
{
"_type": "post",
"_id": 2,
"title": "Post 2",
"description": "Lorem ipsum..."
},
{
"_type": "post",
"_id": 3,
"title": "Post 3",
"description": "Lorem ipsum..."
}
]
DELETE(:route)/:type/:id
HTTP DELETE /post/1
/*
200 OK
*/
[
{
"_type": "post",
"_id": 1,
"title": "Post 1",
"description": "Lorem ipsum..."
}
]
(:route)/:type/:id,...,:id
HTTP DELETE /post/1,2,3
/*
200 OK
*/
[
false,
true,
true
]
Using Connect.js:
var connect = require('connect')
var http = require('http');
var Document = require('node-document');
var API = require('node-document-api');
var Post = Document('Post');
Post.api = API({route: '/api'});
var app = connect();
app
.use(Post.api)
.use(function(req, res) {
res.end("Hello world!");
});
http.createServer(app).listen(3000, function() {
console.log('[node-document-api/examples/connect-example.js]: Listening on port %s', 3000);
});
Using Express.js:
var express = require('express')
var Document = require('node-document');
var API = require('node-document-api');
var Post = Document('Post');
Post.api = API({route: '/api'});
var app = express();
app
.use(Post.api)
.use(function(req, res) {
res.end("Hello world!");
});
app.listen(3000, function() {
console.log('[node-document-api/examples/express-example.js]: Listening on port %s', 3000);
});
$ npm install node-document-api
Local tests:
$ make test
Released under the MIT license.
Copyright (c) Jonas Grimfelt
FAQs
HTTP API endpoint/middleware for `node-document` ODM for Node.js.
We found that node-document-api 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
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.