connect-to-mongoose
v1.0.2
Published
`yarn add mongoose connect-to-mongoose`
Downloads
8
Readme
📦 Installing on command line (requires nodejs)
yarn add mongoose connect-to-mongoose
or
npm i mongoose connect-to-mongoose
👷 Usage
Used for connecting to a mongoose application (boilerplate), if you have a .env file just add a MONGO_URI="" line it's not that necessary, i just hate doing the same over and over again.
.env
MONGO_URI="dsajndsajndjsa:[email protected]"
index.mjs (NODEJS)
import dotenv from "dotenv";
dotenv.config();
import connect from "connect-to-mongoose";
const mongoose = await connect();
index.mjs (bun)
import connect from "connect-to-mongoose";
const mongoose = await connect();
without .env variables
import connect from "connect-to-mongoose";
const connectionString = "dsajndsajndjsa:[email protected]";
const mongoose = await connect(connectionString);