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
import { SimpleEndCustomer, TrackerLogs } from 'redux/types'; | |
import moment from 'moment'; | |
import { colorUsage } from 'stylesheet'; | |
import { InjectedIntl } from 'react-intl'; | |
interface DataItem { | |
y: number; | |
x?: any; | |
z?: any; | |
label?: 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
CREATE TABLE author | |
( | |
id INTEGER NOT NULL | |
AUTO_INCREMENT PRIMARY KEY, | |
nom VARCHAR | |
(50) NOT NULL | |
); | |
CREATE TABLE `post` | |
( |
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 router = express.Router(); | |
const db = require("../mysql"); | |
router.get("/", (req, res) => { | |
db.query("SELECT id, email, name FROM user", (err, results) => { | |
if (err) { | |
res.status(500).json({ | |
error: err.message, | |
sql: err.sql, |
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("/supermiddleware", middleware, (req, res) => { | |
res.send("Hello World !"); | |
}); | |
function middleware(req, res, next) { | |
console.log("Hello middleware"); |
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
# Ecrire les requêtes qui permettent d afficher | |
# Le prénom, nom et âge des personnages | |
SELECT firstname, lastname, age FROM person; | |
+-------------+---------------+-----+ | |
| firstname | lastname | age | | |
+-------------+---------------+-----+ | |
| Arthur | Pendragon | 35 | | |
| Guenièvre | NULL | 30 | |
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(*) AS nb_joueurs FROM player p JOIN team t ON t.id=p.team_id GROUP BY team_id ORDER BY nb_joueurs DESC; | |
+------------+------------+ | |
| name | nb_joueurs | | |
+------------+------------+ | |
| Gryffindor | 36 | | |
| Slytherin | 21 | | |
| Ravenclaw | 15 | | |
| Hufflepuff | 12 | | |
+------------+------------+ | |
4 rows in set (0,00 sec) |
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 firstname, lastname, role, name FROM player JOIN wizard ON player.wizard_id=wizard.id JOIN team ON player.team_id=team.id ORDER BY name ASC, role ASC, lastname ASC, firstname ASC; | |
+-------------+-----------------+--------+------------+ | |
| firstname | lastname | role | name | | |
+-------------+-----------------+--------+------------+ | |
| Sirius | Black | beater | Gryffindor | | |
| Lavender | Brown | beater | Gryffindor | | |
| Seamus | Finnigan | beater | Gryffindor | | |
| Rubeus | Hagrid | beater | Gryffindor | | |
| Alice | Longbottom | beater | Gryffindor | | |
| Minerva | McGonagall | 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
// Get All | |
app.get("/api/movies", (req, res) => { | |
let sql = "SELECT * FROM movie"; | |
const sqlValues = []; | |
if (req.query.rating) { | |
sql += " WHERE rating = ?"; | |
sqlValues.push(req.query.rating); | |
} | |
if (req.query.genre) { | |
sql += " WHERE genre = ?"; |
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.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 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); |
NewerOlder