Skip to content

Instantly share code, notes, and snippets.

View Rooarii's full-sized avatar
✌️
Declare variables, not War ! 🇺🇦

Rooarii MANUEL Rooarii

✌️
Declare variables, not War ! 🇺🇦
View GitHub Profile
xofym pwapp
@Rooarii
Rooarii / gist:5a027f940ba99b7e4cda0e38db47859c
Created December 14, 2020 10:11
TDD en JavaScript 1 - Introduction
const assert = require('assert')
// Type your code here
const capitalizeFirstLetters =(input)=>{
// return input.length && !input.includes(' ') > 0 ? input[0].toUpperCase() + input.slice(1): '';
// first code version
let output = '';
if (input.length >0 && !input.includes(' ') ){
for (let i = 0 ; i < input.length ; i++) {
@Rooarii
Rooarii / gist:fc0dc3a8fa817ad971900ae31ff4af7f
Created December 14, 2020 08:54
Middlewares dans Express
const express =require('express');
const router = express.Router();
router.get('/', (req, res)=>{
res.send('Hello 🌎, welcome on Aliens 👽 API!')
});
let helloMiddleware = (req, res, next) =>{
console.log('hello middleware');
next();
@Rooarii
Rooarii / gist:33b76369e484b29ae8c59f8e1e920fb0
Created December 7, 2020 11:49
Express 5 - Méthode DELETE et suppression de données
// Express 2 - 🚀 Lecture depuis la base de données
const express = require("express");
const movies = require("./movies");
const connection = require("../config");
const port = 3000;
const app = express();
app.use(express.json())
@Rooarii
Rooarii / gist:14e71d8e76add67c3e9eb8de29af8ebd
Created December 7, 2020 11:42
Express 4 - 🛸 Méthode PUT et modification des données
// Express 2 - 🚀 Lecture depuis la base de données
const express = require("express");
const movies = require("./movies");
const connection = require("../config");
const port = 3000;
const app = express();
app.use(express.json())
@Rooarii
Rooarii / gist:1f661209555ba7afc232d60fac78213f
Created December 7, 2020 11:14
Express 3 - 🛰️Poster des données
// Express 2 - 🚀 Lecture depuis la base de données
const express = require("express");
const movies = require("./movies");
const connection = require("../config");
const port = 3000;
const app = express();
app.use(express.json())
QUERY 1
mysql> SELECT name, COUNT(*) AS player_number FROM wizard w JOIN player p ON p.wizard_id=w.id JOIN team t ON p.team_id=t.id GROUP BY name ORDER BY player_number DESC;
+------------+---------------+
| name | player_number |
+------------+---------------+
| Gryffindor | 36 |
| Slytherin | 21 |
| Ravenclaw | 15 |
| Hufflepuff | 12 |
QUERY_1
SELECT name, role, lastname, firstname FROM wizard JOIN player ON player.wizard_id=wizard.id JOIN team ON player.team_id=team.id ORDER BY name ASC, role ASC, lastname ASC, firstname ASC;
+------------+--------+-----------------+-------------+
| name | role | lastname | firstname |
+------------+--------+-----------------+-------------+
| Gryffindor | beater | Black | Sirius |
| Gryffindor | beater | Brown | Lavender |
| Gryffindor | beater | Finnigan | Seamus |
| Gryffindor | beater | Hagrid | Rubeus |
@Rooarii
Rooarii / gist:b85c91dcd1ea74550f6316efcf601e7b
Created November 30, 2020 23:17
Express 2 - 🚀 Lecture depuis la base de données
// Express 2 - 🚀 Lecture depuis la base de données
const express = require("express");
const movies = require("./movies");
const connection = require("../config");
const port = 3000;
const app = express();
@Rooarii
Rooarii / gist:b92cfa8f7945aff956c8c75d932dc75d
Last active November 30, 2020 15:22
Node.js - Créer un serveur HTTP
Node.js - Créer un serveur HTTP
// HTTP server type require http
const http = require('http');
// port on which the server will run
const port = 8000;
// url module import
const url = require('url');