Registry / database / swagger-mongodb

swagger-mongodb

JSON →
library2015.8.3jsnpmunverified

Lightweight Swagger UI CRUD middleware backed by MongoDB. Version 2015.8.3, last published in 2015. Provides a quick way to generate a RESTful API with Swagger documentation from MongoDB collections. Supports basic CRUD operations and automatic Swagger spec generation. Limited to Node 0.10-0.12 and requires MongoDB 2.6+. Not actively maintained; consider using modern alternatives like FeathersJS or PostgREST.

npm install swagger-mongodb
INSTALL
IMPORT
SIG · SWAGGER-MONGODB
S
swagger-mongodb
databasejavascriptv2015.8.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import swaggerMongodb from 'swagger-mongodb'
const swaggerMongodb = require('swagger-mongodb')
Package is ESM-only; no CommonJS support.
crudMiddleware
import { crudMiddleware } from 'swagger-mongodb'
import crudMiddleware from 'swagger-mongodb'
Named export; avoid default import.

Set up a basic Express server with swagger-mongodb middleware for CRUD operations.

import swaggerMongodb from 'swagger-mongodb'; import express from 'express'; const app = express(); const swagger = swaggerMongodb({ mongodbUrl: 'mongodb://localhost:27017/test', customRoutes: { '/api/:collection': ['get'], }, }); app.use('/api', swagger); app.listen(3000, () => console.log('Server running on port 3000'));
Debug
Known issues
deprecatedPackage is unmaintained since 2015 and does not support modern Node.js versions.
fix
Use an alternative like FeathersJS or PostgREST for CRUD APIs.
affects: >=0.0.0
gotchaRequires MongoDB 2.6+ and Node 0.10-0.12; not compatible with newer Node versions.
fix
Use a compatible Node version or migrate to a different package.
affects: >=0.0.0
breakingDatabase URL must be specified in options; no default is provided.
fix
Ensure 'mongodbUrl' is set in the options object.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'swagger-mongodb'
Package is not installed or version is incompatible with modern Node.
fix
npm install swagger-mongodb@2015.8.3
TypeError: swaggerMongodb is not a function
CommonJS require used instead of ESM import, or default import used with named export.
fix
Use import swaggerMongodb from 'swagger-mongodb'
Upgrade
Version history
2015.8.3latest on npm
Audit
Dependencies
mongodbrequiredRequired for database connectivity
swagger-uirequiredProvides Swagger UI frontend
Agent activity
38 hits · last 30 days
node
34
OpenAI (training)
1
Resources
swagger-mongodb — npm install swagger-mongodb · libregistry