It's common for Express developers to define routes in a separate file from the main Express app (app.js
or server.js
). Although our connection pooling blog post teaches developers to reuse a database connection, it's not clear how to implement database connection sharing across multiple files. This is a simple example that demonstrates how to set up MongoDB connections in an Express app so that the database connection can be used across multiple files.
-
Notifications
You must be signed in to change notification settings - Fork 8
mlab/express-mongodb-setup
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
A simple example that demonstrates how to set up MongoDB connections in an Express app.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published