Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // listen to the url "/api/employees" with the verb POST
- app.put('/api/movies/:id', (req, res) => {
- // Get the data sent
- const id = req.params.id;
- const formData = req.body;
- // connection to the database, and insertion of the employee
- connection.query('UPDATE movie SET ? WHERE id = ?', [formData, id], err => {
- if (err) {
- // If an error has occurred, then the user is informed of the error
- console.log(err);
- res.status(500).send("Error editing a movie");
- } else {
- // If everything was successful, we send an "ok" status.
- res.sendStatus(200);
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement