connect-to-mongoose

1.0.2 • Public • Published

📦 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:dsajhudsajd@mongoosebkasdsakdsak.net"

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:dsajhudsajd@mongoosebkasdsakdsak.net";

const mongoose = await connect(connectionString);

Readme

Keywords

none

Package Sidebar

Install

npm i connect-to-mongoose

Weekly Downloads

3

Version

1.0.2

License

ISC

Unpacked Size

1.75 kB

Total Files

3

Last publish

Collaborators

  • joao-bot