This file contains 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"> | |
<!-- Redux CDN --> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux/4.0.1/redux.min.js"></script> |
This file contains 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
SELECT team.name, COUNT(wizard_id) AS nb_players | |
FROM player | |
JOIN team ON team.id=player.team_id | |
JOIN wizard ON wizard.id=player.wizard_id | |
GROUP BY team.name | |
ORDER BY nb_players DESC; | |
SELECT team.name |
This file contains 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
select * from wizard | |
left join player on player.wizard_id=wizard.id | |
where player.role IS NULL; |
This file contains 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.delete('/api/movies/:id', (req, res) => { | |
const idMovie = req.params.id; | |
connection.query('DELETE FROM movie WHERE id = ?', [idMovie], err => { | |
if (err) { | |
console.log(err); | |
res.status(500).send("Erreur lors de la suppression d'un film"); | |
} else { | |
res.sendStatus(200); | |
} | |
}); |
This file contains 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 formData = req.body; | |
const idMovie = req.params.id; | |
connection.query("UPDATE movie SET ? WHERE id=?", [formData, idMovie], err => { | |
if (err){ | |
console.log(err); | |
res.status(500).send("erreur lors de la modification"); | |
}else{ | |
res.sendStatus(200); | |
} |
This file contains 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"); | |
app.get("/api/movies", (req, res) => { | |
connection.query("SELECT * from movie", (err, results) => { | |
if (err) { |
This file contains 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 = 3001; | |
const connection = require("./conf"); | |
app.get("/api/movies", (req, res) => { | |
connection.query("SELECT * from movie", (err, results) => { | |
if (err) { |
This file contains 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; | |
app.get('/api/movies', (request, response) => { | |
response.send("Récupération de tous les films"); | |
}); | |
app.get('/api/movies/:id', (req, response) => { | |
const id = req.params.id; | |
response.json({ id: `${id}` }); |
This file contains 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
mysql> INSERT INTO school (name, country, capacity) | |
-> VALUES ("Beauxbatons Academy of Magic", "France", 550), | |
-> ("Castelobruxo", "Brazil", 380), | |
-> ("Durmstrang Institute", "Norway", 570), | |
-> ("Hogwarts School of Witchcraft and Wizardry", "United Kingdom", 450), | |
-> ("Ilvermorny School of Witchcraft and Wizardry", "USA", 300), | |
-> ("Koldovstoretz", "Russia", 125), | |
-> ("Mahoutokoro School of Magic", "Japan", 800), | |
-> ("Uagadou School of Magic", "Uganda", 350); |
This file contains 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 port = 3000; | |
const requestHandler = (request, response) => { | |
console.log(request.url); | |
let sentence; | |
let url = request.url.split('/'); | |
console.log(url[1]); | |
switch(url[1]){ | |
case 'contact' : |
NewerOlder