From f536cc413d22707a89f77251420a298bcf9a7116 Mon Sep 17 00:00:00 2001 From: LuisGuilherme-SM <81170691+LuisGuilhermeSouzaM@users.noreply.github.com> Date: Fri, 2 Jun 2023 17:10:20 -0300 Subject: [PATCH] =?UTF-8?q?Segundo=20microservi=C3=A7o=20(Gerenciamento=20?= =?UTF-8?q?de=20Compromissos)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- calendar/server.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/calendar/server.ts b/calendar/server.ts index 9d52d9e..c60dec7 100644 --- a/calendar/server.ts +++ b/calendar/server.ts @@ -4,6 +4,7 @@ app.use(express.json()); // Configuração do client de conexões com o PostgreSQL import client from './configs/database'; +client.connect(); // Rota para obter os compromissos de um usuário app.get('/user/:userId/appointments', async (req: Request, res: Response) => { @@ -14,7 +15,7 @@ app.get('/user/:userId/appointments', async (req: Request, res: Response) => { const query = 'SELECT id, title, date FROM appointments WHERE user_id = $1'; const values = [userId]; const result = await client.query(query, values); - + const appointments = result.rows; res.json(appointments);