Skip to content

Instantly share code, notes, and snippets.

@WoolDoughnut310
Created October 28, 2022 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WoolDoughnut310/89324054898c615b28acdfc6661eb1ed to your computer and use it in GitHub Desktop.
Save WoolDoughnut310/89324054898c615b28acdfc6661eb1ed to your computer and use it in GitHub Desktop.
router.get(
"/me",
asyncHandler(async (req: Request, res: Response) => {
const db = getDb();
const collection = db.collection<Song>("song");
const songs = await collection
.find({ userId: req.auth.id })
.sort({ date: -1 })
.toArray();
res.status(200).json(songs);
})
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment