Created
          September 14, 2020 07:43 
        
      - 
      
- 
        Save alyson-b69/9d002626c1dc72660cc8ccdfe3d4a260 to your computer and use it in GitHub Desktop. 
    Express 4 - Méthode PUT
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | app.put("/api/movies/:id", (req, res) => { | |
| const idMovie = req.params.id; | |
| const formData = req.body; | |
| connection.query( | |
| "UPDATE movie SET ? WHERE id = ?", | |
| [formData, idMovie], | |
| (err) => { | |
| if (err) { | |
| console.log(err); | |
| res.status(500).send("Erreur lors de la modification d'un film"); | |
| } else { | |
| res.sendStatus(200); | |
| } | |
| } | |
| ); | |
| }); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment