
Product
Introducing Data Exports
Export Socket alert data to your own cloud storage in JSON, CSV, or Parquet, with flexible snapshot or incremental delivery.
express-mongo-router
Advanced tools
This is a small library that offers easy access to MongoDB collection via REST endpoint by offering an Express router.
This example starts an express server on port 3000 with a fruits resource.
const express = require('express');
const MongoClient = require('mongodb');
const Router = require('.').Router;
const MongoURI = 'mongodb://localhost:27017/example';
const server = express();
const port = 3000;
const Collection = name => {
return MongoClient.connect(MongoURI)
.then(database => {
return database.collection(name);
});
}
const name = 'fruits';
Collection(name).then(collection => {
const router = Router(name, collection);
server.use(router);
console.log(`Express server listening on port ${port}`);
server.listen(port);
});
FAQs
RESTful Express router for MongoDB collections
We found that express-mongo-router 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.

Product
Export Socket alert data to your own cloud storage in JSON, CSV, or Parquet, with flexible snapshot or incremental delivery.

Research
/Security News
Bitwarden CLI 2026.4.0 was compromised in the Checkmarx supply chain campaign after attackers abused a GitHub Action in Bitwarden’s CI/CD pipeline.

Research
/Security News
Docker and Socket have uncovered malicious Checkmarx KICS images and suspicious code extension releases in a broader supply chain compromise.