expressjs.com
expressjs.com copied to clipboard
Create helpful database integration guide
Per #476, let's revise/replace http://expressjs.com/guide/database-integration.html to be more helpful, without delving into specifics of various ORMs.
From that issue:
what we need is documentation to show how to glue things together with Express. For example, perhaps someone has a Winston logger or a MySQL connection and they don't know what the best practices are for having these managed with a request/response life cycle and exposed to their routes.
@crandmck where is the source for that document? And can I contribute to it?
@vitaly-t It's just https://github.com/strongloop/expressjs.com/blob/gh-pages/en/guide/database-integration.md.
@crandmck thank you!
If I submit a PR to change the PostgreSQL integration via pg-promise, any chance it will be accepted?
The example would be simplified, and much more modern-looking.
We would certainly consider it. Ultimately, it would be up to @dougwilson, but it sounds reasonable to me.
Thank you, I have just submitted it.
To clarify, based on comments from #476:
we need to show how to glue things together with Express. For example, perhaps someone has a Winston logger or a MySQL connection and they don't know what the best practices are for having these managed with a request/response life cycle and exposed to their routes. I think that's probably more useful from an Express point of view compared to the existing page.
Reading through the database guide, it's really just repeating how to use the various modules at a basic level without any express (or web application in general) specifics. I think a good addition would be around best practices when using a DB. A few things immediately come to mind:
- don't create a new db connection for every request
- closing the DB connection when your application shuts down
#522 was merged, and at this point the rest is out of scope.