Skip to content
This repository has been archived by the owner on Jun 15, 2022. It is now read-only.

unlimitedcoder2/express-mongodb

Repository files navigation

express-mongodb-middleware

npm GitHub license GitHub stars

npm install express-mongodb-middleware

Example

import express from "express";
import mongodb from "mongodb";
import expressMongo from "express-mongodb-middleware";

const app = express();

const db = new mongodb.MongoClient();

app.use(expressMongo(db));

app.get("/", (req, res) => {
    const database = req.db;
    // Use the connected MongoClient here.
});

app.listen(3000, () => console.log("Listening!"));

Releases

No releases published

Packages

No packages published