Skip to content
Snippets Groups Projects
Verified Commit fb625423 authored by insert's avatar insert
Browse files

Should be a GET request.

parent 224af321
No related merge requests found
......@@ -6,14 +6,14 @@ import databaseMiddleware from '../../components/middleware/database';
const handler = nc<NextApiRequest, NextApiResponse>();
handler.use(databaseMiddleware);
handler.post(async (req: NextApiRequest, res: NextApiResponse) => {
handler.get(async (req: NextApiRequest, res: NextApiResponse) => {
try {
if (req.body.id === undefined) {
if (req.query.id === undefined) {
res.status(400).json({ success: false, error: "No id provided." });
return;
}
const id = req.body.id;
const id = req.query.id;
const coll = (req as any).db.collection('users');
let result = await coll.findOne({ id });
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment