Preview:
import User from "@/models/User";
import connectDb from "@/middleware/connectDb";

const handler = async (req, res) => {
  console.log(req.body);
  if(req.method == 'POST'){
    // Queries
    res.status(200).send({msg:"Success"})
  }
  else{
    res.status(400).send({msg:"Bad Request"})
  }
}
export default connectDb(handler);
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter