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 connection = require("./conf"); | |
const app = express(); | |
const port = 3000; | |
app.get("/api/movies", (req, res) => { | |
let sql = "SELECT * FROM movie"; | |
const sqlValues = []; |
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"); | |
// Support JSON-encoded bodies | |
app.use(bodyParser.json()); | |
// Support URL-encoded bodies | |
app.use( |
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(*) AS nb_wizard | |
from (wizard | |
JOIN player ON (player.wizard_id=wizard.id) | |
JOIN team ON (player.team_id=team.id)) | |
GROUP BY team.id | |
ORDER BY nb_wizard DESC; | |
'Gryffindor', '36' | |
'Slytherin', '21' |
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 firstname, lastname | |
from wizard | |
LEFT JOIN player ON player.wizard_id=wizard.id | |
where player.role is null; | |
'Terry', 'Boot' | |
'Crabbe', '' | |
'Remus', 'Lupin' | |
'Padma', 'Patil' | |
'Parvati', 'Patil' |
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"); | |
// Support JSON-encoded bodies | |
app.use(bodyParser.json()); | |
// Support URL-encoded bodies | |
app.use( |
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"); | |
// Support JSON-encoded bodies | |
app.use(bodyParser.json()); | |
// Support URL-encoded bodies | |
app.use( |
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"); | |
// Support JSON-encoded bodies | |
app.use(bodyParser.json()); | |
// Support URL-encoded bodies | |
app.use( |
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"); | |
app.get("/api/movies", (req, res) => { | |
connection.query("SELECT * from movie", (err, results) => { | |
if (err) { | |
res.status(500).send("Erreur lors de la récupération des films"); | |
} else { |
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
### | |
GET https://http-practice.herokuapp.com/wilders | |
Accept: application/json | |
### | |
GET https://http-practice.herokuapp.com/wilders?language=JavaScript&page=2 | |
Accept: application/json | |
### | |
POST https://http-practice.herokuapp.com/wilders |
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(`/`, (request, response) => { | |
response.send("Bienvenue sur Express"); | |
}); | |
app.get(`/api/movies`, (request, response) => { | |
response.send("Récupération de tous les films"); |
NewerOlder