
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
koa-rest-mongoose
Advanced tools
mongoose rest generator for koa1
npm install koa-rest-mongoose
const koa = require('koa');
const mongoose = require('mongoose');
const KoaRestMongoose = require('koa-rest-mongoose');
// 1 step, mongoose
const mongoUrl = '127.0.0.1:27017/koa_rest_mongoose';
const schema = new mongoose.Schema({
email: String,
name: String,
password: String,
address: String,
zipcode: Number,
lists: Array
});
mongoose.connect(mongoUrl);
mongoose.model('user', schema);
// 2 step, koa and router
const app = koa();
const rest = KoaRestMongoose({
prefix: '/api'
});
app.use(rest.routes());
// 3 step, done
app.listen(process.env.PORT || 5000);
Following REST API is now created for you:
HTTP Verb | /users | /users/:id |
---|---|---|
GET | Get all documents, or documents that match the query. You can use [mongoose find conditions] (http://mongoosejs.com/docs/queries.html), limit, skip and sort. For example: /api/users?conditions={"name":"john"}&limit=10&skip=1&sort=-zipcode | Get the addressed document. |
POST | Create a new document and send it back. | Update the addressed document with specified attributes. |
PUT | Create a new document and send it back. | Replace the addressed document. |
DELETE | n/a | Delete the addressed document. |
PATCH | n/a | Update the addressed document with specified attributes. |
FAQs
mongoose rest generator for koa
The npm package koa-rest-mongoose receives a total of 0 weekly downloads. As such, koa-rest-mongoose popularity was classified as not popular.
We found that koa-rest-mongoose 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.