Skip to content

Instantly share code, notes, and snippets.

@aleksejkozin
Created December 1, 2021 00:57
Show Gist options
  • Save aleksejkozin/506c4a21321769fbb81efa0e282d3e82 to your computer and use it in GitHub Desktop.
Save aleksejkozin/506c4a21321769fbb81efa0e282d3e82 to your computer and use it in GitHub Desktop.
const {Pool} = require('pg')
const app = express()
const pool = new Pool({
// confing
})
app.get('/submissions', requiresAuth(), async (req, res) => {
const {rows} = await pool.query(
`
SELECT *
FROM submissions
WHERE created_by = $1
ORDER BY updated DESC
`,
[req?.oidc?.user?.email],
)
res.json(rows)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment