-
-
Save kameshsampath/e550d5bf19feb9b59d0ec1871e59b53a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Request, Response } from "express"; | |
import { app, db } from "../app"; | |
import { loadCollection } from "../utils/collectionUtils"; | |
//Get all frames | |
app.get("/api/frames", async (req: Request, res: Response, next: any) => { | |
//TODO move this to higher order function | |
try { | |
const qCollection = await loadCollection("frames", db); | |
const docs = qCollection.find(); | |
if (docs) { | |
return res | |
.contentType("json") | |
.status(200) | |
.send(docs); | |
} | |
} catch (err) { | |
res.status(404).send(err); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment