This is a boilerplate project to quickly create an express server that has multiple mongo connections and models that respond to such connections only.
JavaScript Standard
- express As the main server
- mongoose As the mongo DB ODM
- JOI As data validator
- webpack For bundling and development purposes
- Babel For polyfilling and ES support
-
Clone the repo
git clone https://github.com/victorstein/multi-mongo-express.git
-
Enter the repo directory
cd multi-mongo-express
-
Install the dependencies
npm install
-
Create a .env file with the following set up
KEY | TYPE | DESCRIPTION | VALUE |
---|---|---|---|
NODE_ENV | string | Database host | development |
PORT | string | Connection port | 4000 |
DB_USER_1 | string | Username of first connection | user |
DB_PASSWORD_1 | string | Password of first connection | password |
DB_URI_1 | string | URI of first connection | @ cluster0-xxxxx.mongodb.net/Example ?retryWrites=true&w=majority |
DB_USER_2 | string | Username of second connection | user |
DB_PASSWORD_2 | string | Password of second connectiont | password |
DB_URI_2 | string | Password of first connection | @ cluster0-xxxxx.mongodb.net/Example ?retryWrites=true&w=majority |
🙄 Or just look at the example env of the project 🙄
- Finally, just run
npm run dev
for development, ornpm run build
for webpack, ornpm start
(once built) to run production
Feel free to submit your PRs for review. There's currently no template for contribution. As the project grows we will look into further implementation of this.
Alfonso Gomez 💬 📖🔧 👀 😎 |
This project is licensed under the ISC License