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; | |
app.use(express.json()); | |
app.use(express.urlencoded({extended: true})); | |
app.get('/api/employees', (req, res) => { |
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
SELECT t.name, COUNT(p.wizard_id) AS nb_player | |
FROM player p | |
LEFT JOIN team t ON t.id=p.team_id | |
GROUP BY t.name | |
ORDER BY nb_player DESC; | |
SELECT t.name, COUNT(p.wizard_id) AS nb_player | |
FROM player p | |
LEFT JOIN team t ON t.id=p.team_id |
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
SELECT w.firstname, w.lastname, p.role, t.name | |
FROM wizard w | |
LEFT JOIN player p ON w.id=p.wizard_id | |
LEFT JOIN team t ON p.team_id=t.id | |
ORDER BY t.name, p.role, w.lastname, w.firstname; | |
SELECT w.firstname, w.lastname, p.role | |
FROM wizard w | |
INNER JOIN player p ON w.id=p.wizard_id |
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 wilder | |
GET https://http-practice.herokuapp.com/wilders | |
Accept: application/json | |
### GET wilder | |
GET https://http-practice.herokuapp.com/wilders?language=Java&page=2 | |
Accept: application/json | |
### POST wilder | |
POST https://http-practice.herokuapp.com/wilders |
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
- Le protocole HTTP est une manière normalisée de gerer l'émission d'une requête et la reception de la réponse contenant des données. | |
- La Base de donnée est la partie où sont stockées les données qu'il n'est possible d'interroger que par l'intermediaire d'un langage propre (SQL pour MySQL). | |
- Le Serveur d'application est l'intermediaire indispensable pour interagir avec la BDD. Ces Serveurs d'application sont généralement codés en ava, PHP, C#, Python et Ruby et plus récemment Javascript grâce à Node.js. |
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; | |
app.get('/api/employees', (req, res) => { | |
connection.query('SELECT * from employee', (err, results) => { | |
if(err) { | |
console.log(err); |
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
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); | |
UPDATE school SET country='Sweden' WHERE name='Durmstrang Institute'; | |
UPDATE school SET capacity=700 WHERE name='Mahoutokoro School of Magic'; | |
DELETE FROM school WHERE name LIKE '%Magic'; |
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
+----+-----------+----------+------------+-------------+---------------------------------------+-----------+ | |
| id | firstname | lastname | birthday | birth_place | biography | is_muggle | | |
+----+-----------+----------+------------+-------------+---------------------------------------+-----------+ | |
| 1 | harry | potter | 1980-07-31 | london | | 0 | | |
| 2 | hermione | granger | 1979-09-19 | | Friend of Harry Potter | 0 | | |
| 4 | ron | weasley | 1980-03-01 | | Best friend of Harry | 0 | | |
| 5 | ginny | weasley | 1981-08-11 | | Sister of Ron and girlfriend of Harry | 0 | | |
| 6 | fred | weasley | 1978-04-01 | | | 0 | | |
| 7 | george | weasley | 1978-04-01 | | | 0 | | |
| 10 | drago | malefoy | 1980-06-05 | |
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
function hello(name: string) { | |
console.log("Hello " + name); | |
} | |
var firstName = "bob"; | |
hello(firstName); | |
hello(firstName + " marley"); | |
function concat(a: string, b: string) { |
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; | |
app.get('/api/movies', (req, res) => { | |
res.send('Récupération de tous les films'); | |
}); | |
app.get('/api/movies/:id', (req, res) => { |