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 React from "react"; | |
| import ReactDOM from "react-dom"; | |
| import App from "./App"; | |
| import reportWebVitals from "./reportWebVitals"; | |
| import { | |
| ApolloClient, | |
| InMemoryCache, | |
| gql, | |
| ApolloProvider, |
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
| interface myUser { | |
| name: string; | |
| age?: number; | |
| birthday?: string; | |
| } | |
| const prettyPrintWilder = (users : myUser[]) => { | |
| console.log("########################"); | |
| users.map((el : myUser) => { |
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
| // clone this gist to a empty folder, the run: | |
| // npm init (and follow steps) | |
| // npm install express --save | |
| // npm install swig --save | |
| // node app.js and open http://localhost:3000 | |
| function App() { | |
| var express = require('express'); |
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(); | |
| router.get( | |
| "/superMiddleware", | |
| function (req, res, next) { | |
| s; | |
| console.log("hello middleware"); | |
| next(); |
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("./config"); | |
| const app = express(); | |
| const port = 3050; | |
| app.listen(port, (err) => { | |
| if (err) { | |
| throw new Error("Something bad happen"); | |
| } |
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.lastname, w.firstname, p.role, t.name | |
| FROM wizard w | |
| JOIN player p ON w.id=p.wizard_id | |
| JOIN team t ON t.id=p.team_id | |
| ORDER BY t.name, p.role, w.lastname, w.firstname; | |
| +-----------------+-------------+--------+------------+ | |
| | lastname | firstname | role | name | | |
| +-----------------+-------------+--------+------------+ | |
| | Black | Sirius | beater | Gryffindor | | |
| | Brown | Lavender | 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("./config"); | |
| const express = require("express"); | |
| const port = 6667; | |
| const app = express(); | |
| app.use(express.json()); | |
| connection.then((connection) => { | |
| console.log(`connected on database as id ${connection.threadId}`); | |
| app.get("/", (req, res) => { |
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("./config"); | |
| const express = require("express"); | |
| const port = 6667; | |
| const app = express(); | |
| app.use(express.json()); | |
| connection.then((connection) => { | |
| app.get("/", (req, res) => { | |
| res.send("Welcome to my favorite movie lists !!!"); | |
| connection |
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
| /*connection.query ne fonctionne pas :/ | |
| Vu avec Pierre : j'utilise du coup connection.execute.then | |
| Avec cette méthode, | |
| je ne traite pas les cas où l'on a une erreur et | |
| on retourne un status(400).send('erreur') | |
| Bisou | |
| ---------------------------------------------------------------- | |
| */ | |
| const connection = require("./config"); |
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("./config"); | |
| const express = require("express"); | |
| const port = 3005; | |
| const app = express(); | |
| connection.then((connection) => { | |
| app.get("/", (req, res) => { | |
| res.send("Welcome to my favorite movie lists !!!"); | |
| connection | |
| .execute("SELECT * FROM movies") |
NewerOlder