source: app/lib/db.ts

nextjs
Last change on this file was c50bcea, checked in by Vasilaki Tocili <vasilakigorgi@…>, 4 months ago

feat: implement Dashboard

  • Fully implement the UI for the Dashboard Page with fetching of the

data from the database, and calculating the averages for it in the
lib/queries.ts

  • Now the app has a single sql client in the db.ts which can and will

be reusable

  • Property mode set to 100644
File size: 349 bytes
Line 
1import postgres from 'postgres';
2
3declare global {
4 // eslint-disable-next-line no-var
5 var __fein_sql: ReturnType<typeof postgres> | undefined;
6}
7
8export const sql =
9 global.__fein_sql ??
10 postgres(process.env.POSTGRES_URL!, {
11 ssl: 'require',
12 });
13
14if (process.env.NODE_ENV !== 'production') {
15 global.__fein_sql = sql;
16}
Note: See TracBrowser for help on using the repository browser.