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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>Counter Redux</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux/4.0.4/redux.min.js"></script> | |
</head> |
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.get('/api/movies/:id', (req, res) => { | |
const idMovie = req.params.id; | |
connection.query('SELECT * from movie where id = ?', idMovie, (err, results) => { | |
if (err) { | |
res.status(500).send('Error retrieving the movie'); | |
} else { | |
if (results.length == 0) { | |
res.status(404).send("Movie not found") | |
} | |
res.json(results[0]); |
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
### GET Student Wilder | |
GET https://http-practice.herokuapp.com/wilders | |
### GET Student Wild JAVASCRIPT | |
GET https://http-practice.herokuapp.com/wilders?language=JavaScript | |
### GET Student Wild page=1000000 | |
GET https://http-practice.herokuapp.com/wilders?page=1000000 | |
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
const connection = require('./conf'); | |
const express = require('express'); | |
const app = express(); | |
const port = 3000; | |
const bodyParser = require('body-parser'); | |
// écoute de l'url "/api/movies" | |
app.delete('/api/movies/:id', (req, res) => { | |
// récupération des données envoyées |
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
const express = require('express'); | |
const app = express(); | |
const port = 3000; | |
const connection = require('./conf'); | |
const bodyParser = require('body-parser'); | |
// Support JSON-encoded bodies | |
app.use(bodyParser.json()); | |
// Support URL-encoded bodies | |
app.use(bodyParser.urlencoded({ |
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
const connection = require('./conf'); | |
const express = require('express'); | |
const app = express(); | |
const port = 3000; | |
const bodyParser = require('body-parser'); | |
app.use(bodyParser.json()); | |
app.use(bodyParser.urlencoded({ |
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
const http = require('http'); | |
const url = require('url'); | |
const port = 8000; | |
const requestHandler = (request, response) => { | |
const personne = (url.parse(request.url, true).query); | |
if( personne.name && personne.city){ | |
response.end("Hello "+personne.name+", from "+personne.city); | |
} | |
else{ |
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
https://zupimages.net/viewer.php?id=20/02/5dn3.png | |
https://zupimages.net/viewer.php?id=20/02/a0zq.png | |
https://image.noelshack.com/fichiers/2020/03/1/1578908964-capture-d-ecran-de-2020-01-13-10-48-56.png |
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
const express = require('express'); | |
const connection = require('./conf'); | |
const app = express(); | |
const port = 3000; | |
app.get('/', (request, response) => { | |
response.send('Bienvenue !'); | |
}); | |
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
// Une route répondant à l'url /api/movies qui envoie comme informations une chaîne de caractères contenant "Récupération de tous les films" | |
// Une route répondant à l'url /api/movies/\<id du film\> qui envoie comme information un objet JSON contenant {id: \<id du film\>} | |
// Une route répondant à l'url /api/employee/ qui envoie un statut 304 | |
// Une route répondant à l'url /api/employee?name=\<nom de l'employé> qui envoie un statut 404 avec comme information une chaîne de caractère contenant "Impossible de récupérer l'employé \<nom de l'employé>" | |
const express = require('express'); | |
const app = express(); | |
const port = 3000; |
NewerOlder