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 = process.env.PORT || 3000; | |
/* --- GET All --- */ | |
app.get("/api/movies", (req, res) => { | |
let sql = "SELECT * FROM movie"; | |
const sqlValues = []; |
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 lang="fr"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> | |
<title>Redux Counter</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux/4.0.1/redux.min.js"></script> | |
</head> | |
</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
mysql> SELECT team.name, COUNT(player.team_id) AS nb_player | |
-> FROM team | |
-> JOIN player ON player.team_id = team.id | |
-> GROUP BY team.name | |
-> ORDER BY nb_player DESC; | |
+------------+-----------+ | |
| name | nb_player | | |
+------------+-----------+ | |
| Gryffindor | 36 | |
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
mysql> SELECT w.firstname, w.lastname, p.role, t.name | |
-> FROM player p | |
-> JOIN wizard w ON w.id=p.wizard_id | |
-> JOIN team t ON t.id=p.team_id | |
-> ORDER BY t.name ASC, p.role ASC, w.lastname ASC, w.firstname ASC; | |
+-------------+-----------------+--------+------------+ | |
| firstname | lastname | role | name | | |
+-------------+-----------------+--------+------------+ | |
| Sirius | Black | beater | Gryffindor | |
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 bodyParser = require("body-parser"); | |
const express = require("express"); | |
const app = express(); | |
const port = process.env.PORT || 3000; | |
app.use(bodyParser.json()); | |
app.get("/api/movies", (req, res) => { | |
// TODO récupération des données (étape 2) |
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 bodyParser = require("body-parser"); | |
const express = require("express"); | |
const app = express(); | |
const port = process.env.PORT || 3000; | |
app.use(bodyParser.json()); | |
app.get("/api/movies", (req, res) => { | |
// TODO récupération des données (étape 2) |
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 bodyParser = require("body-parser"); | |
const express = require("express"); | |
const app = express(); | |
const port = process.env.PORT || 3000; | |
app.use(bodyParser.json()); | |
app.post("/api/movies", (req, res) => { | |
// TODO récupérer les données (étape 2) |
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 = process.env.PORT || 3000; | |
app.get("/api/movies", (req, res) => { | |
// TODO récupération des données (étape 2) | |
connection.query("SELECT * FROM movie", (err, results) => { | |
// TODO envoyer les données récupérées (étape 3) | |
if (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
const connection = require("./conf"); | |
const express = require("express"); | |
const app = express(); | |
const port = process.env.PORT || 3000; | |
app.get("/api/movies", (req, res) => { | |
// TODO récupération des données (étape 2) | |
connection.query("SELECT * FROM movie", (err, results) => { | |
// TODO envoyer les données récupérées (étape 3) | |
if (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
const express = require("express"); | |
const app = express(); | |
const port = process.env.PORT || 3000; | |
app.get("/", (req, res) => { | |
res.send("Hello World"); | |
}); | |
app.get("/api/movies", (req, res) => { | |
res.send("Recupération de tout les films..."); |
NewerOlder