diff --git a/server/src/routes/auth.ts b/server/src/routes/auth.ts index 3b30328a..845975fa 100644 --- a/server/src/routes/auth.ts +++ b/server/src/routes/auth.ts @@ -35,4 +35,19 @@ router.get('/auth/google/callback', async (req, res) => { console.error('Error during authentication:', error); res.status(500).send('Authentication failed'); } - }); \ No newline at end of file + }); + +router.get('/sheets', async (req, res) => { + try { + const drive = google.drive({ version: 'v3', auth: oauth2Client }); + const response = await drive.files.list({ + q: "mimeType='application/vnd.google-apps.spreadsheet'", + fields: 'files(id, name)' + }); + res.json(response.data.files); + } catch (error) { + console.error('Error listing sheets:', error); + res.status(500).send('Failed to list sheets'); + } + }); + \ No newline at end of file