Hello - I'm building a site using Astro and love it so far! I'm using Astro in SSR mode. Content is stored in a PostgreSQL database, and as the component tree is traversed, calls are made to the database. All components are rendered server-side. I was wondering if there were any lifecycle hooks that trigger when handling of a page request begins and is completed to
a) establish a connection to the db on page creation
b) close the connection on page completion
Or is there a better way of doing this? (Integrations? API layer?) Thanks!
#SSR mode - hooks for creating and completing a page request?
2 messages · Page 1 of 1 (latest)
You could try creating an API route https://docs.astro.build/en/core-concepts/endpoints/#server-endpoints-api-routes