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 prettyPrintWilder = (users: { name: string; age?: number ; birthday?: string}[]) => { | |
| console.log("########################"); | |
| users.map((el) => { | |
| console.log(`${el.name} is ${el.age} years old`); | |
| }); | |
| console.log("########################"); | |
| }; | |
| // # autre synthaxe | |
| // interface User { |
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 connection = require('./conf'); | |
| const app = express(); | |
| const port = 8000; | |
| app.use(express.json()); | |
| app.use(express.urlencoded({ | |
| extended: true | |
| })); |
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 connection = require('./conf'); | |
| const app = express(); | |
| const port = 8000; | |
| app.use(express.json()); | |
| app.use(express.urlencoded({ | |
| extended: true | |
| })); |
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 connection = require('./conf'); | |
| const app = express(); | |
| const port = 8000; | |
| app.use(express.json()); | |
| app.use(express.urlencoded({ | |
| extended: true | |
| })); |
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 name, COUNT(*) | |
| FROM player | |
| JOIN team | |
| ON player.team_id = team.id | |
| GROUP BY name | |
| ORDER BY COUNT(*) DESC; | |
| SELECT name, COUNT(*) | |
| FROM team | |
| JOIN player |
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 lastname, firstname, role, name | |
| FROM wizard | |
| INNER JOIN player | |
| ON wizard.id = player.wizard_id | |
| INNER JOIN team | |
| ON player.team_id = team.id | |
| ORDER BY name, role, lastname, firstname ASC; | |
| SELECT firstname, lastname |
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 connection = require('./conf'); | |
| const app = express(); | |
| const port = 3000; | |
| // écoute de l'url "/api/employees" | |
| app.get('/api/employees', (req, res) => { | |
| // connection à la base de données, et sélection des employés | |
| connection.query('SELECT * from employee', (err, results) => { | |
| 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 = 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'); |
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 http = require('http'); | |
| const url = require('url'); | |
| const port = 8000; | |
| const requestHandler = (request, response) => { | |
| const requestedUrl = request.url | |
| const parsedUrl = url.parse(requestedUrl, true); | |
| const name = parsedUrl.query.name | |
| const city = parsedUrl.query.city |
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 application status | |
| GET https://http-practice.herokuapp.com/status | |
| ### GET application status (format JSON) | |
| GET https://http-practice.herokuapp.com/status | |
| Accept: application/json | |
| ### GET fictional wilders (format JSON for PHP 2nd page) | |
| GET https://http-practice.herokuapp.com/wilders?language=PHP&page=2 | |
| Accept: application/json |
NewerOlder