Skip to content

Instantly share code, notes, and snippets.

@hieptl
Created December 3, 2021 04:08
Show Gist options
  • Select an option

  • Save hieptl/4bb69fbdb7d0ae1655b5da0a29612c05 to your computer and use it in GitHub Desktop.

Select an option

Save hieptl/4bb69fbdb7d0ae1655b5da0a29612c05 to your computer and use it in GitHub Desktop.
meetings.js - server - create meeting - Zoom Clone
app.post("/meetings", (req, res) => {
const { name, uid, createdBy } = req.body;
if (!name || !uid) {
return res.status(200).jsonp({ message: "Please provide the meeting name and meeting uid" });
}
const meetings = [[name, uid, createdBy]];
const createMeetingSql = "INSERT INTO meeting (meeting_title, meeting_uid, created_by) VALUES ?";
dbConn.query(createMeetingSql, [meetings], function (error, insertedMeeting) {
if (insertedMeeting) {
res.status(200).jsonp({ insertId: insertedMeeting.insertId });
} else {
console.log(error);
res.status(200).jsonp({ message: 'Cannot create your meeting, please try again' });
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment