expressjs.com icon indicating copy to clipboard operation
expressjs.com copied to clipboard

Create helpful database integration guide

Open crandmck opened this issue 8 years ago • 7 comments

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 avatar Oct 28 '15 21:10 crandmck

@crandmck where is the source for that document? And can I contribute to it?

vitaly-t avatar Dec 06 '15 12:12 vitaly-t

@vitaly-t It's just https://github.com/strongloop/expressjs.com/blob/gh-pages/en/guide/database-integration.md.

crandmck avatar Dec 07 '15 18:12 crandmck

@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.

vitaly-t avatar Dec 07 '15 18:12 vitaly-t

We would certainly consider it. Ultimately, it would be up to @dougwilson, but it sounds reasonable to me.

crandmck avatar Dec 11 '15 23:12 crandmck

Thank you, I have just submitted it.

vitaly-t avatar Dec 12 '15 15:12 vitaly-t

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.

crandmck avatar Jan 15 '16 22:01 crandmck

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

ryhinchey avatar Apr 08 '20 19:04 ryhinchey

#522 was merged, and at this point the rest is out of scope.

crandmck avatar Apr 03 '24 03:04 crandmck