Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f24be83
Quête Express 01.2
YounesSefiani Nov 13, 2023
a3b5070
Quête Express 01.2bis
YounesSefiani Nov 21, 2023
dd8c5db
Quête Express 02
YounesSefiani Nov 29, 2023
bd273b0
Quête Express 02.1
YounesSefiani Nov 30, 2023
70cc7ac
Enregistrement provisoire pour modification
YounesSefiani Dec 6, 2023
f653ed9
Quête Express 03 (PUT/UPDATE)
YounesSefiani May 22, 2024
295a51a
Quête Express 03.1 : Tests
YounesSefiani May 22, 2024
5e6df51
Quête 03.2 - validateMovie - Champs manquants : Mèthode 1 de validati…
YounesSefiani May 22, 2024
c6cad43
Quête 03.2 - validateMovie - Champs manquants : Mèthode 2 de validati…
YounesSefiani May 22, 2024
aba6006
Quête 03.2 - validateUser - Email : Mèthode de validation manuelle de…
YounesSefiani May 22, 2024
cfd9c9d
Quête 03.2 - validateUser - Mèthode de validation de la saisie de l'e…
YounesSefiani May 22, 2024
7d391fc
Quête 03.2 - validateUser - Mèthode de validation de la saisie de l'e…
YounesSefiani May 22, 2024
761784b
Quête 03.2 - Challenge
YounesSefiani May 22, 2024
75e9c00
Méthode DELETE pour movies
YounesSefiani May 22, 2024
4d51e67
Challenge DELETE pour users
YounesSefiani May 22, 2024
38180f9
Tests DELETE pour movies & users + corrections de tout le CRUD, notam…
YounesSefiani May 24, 2024
abc8d66
Correction des tests + derniers tests (100% Ok sur l'ensemble)
YounesSefiani May 24, 2024
526e1cd
Quête 7 : Enregistrement sécurisé (mot de passe)
YounesSefiani May 24, 2024
61fb357
Quête Express 08 : Authentification JWT
YounesSefiani May 27, 2024
7a08154
Test
YounesSefiani May 27, 2024
c018898
Quête 08 : Bonus
YounesSefiani May 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASSWORD=39942521Bw!
DB_NAME=express_quests
JWT_SECRET=EA245OTcId
7 changes: 6 additions & 1 deletion .env.sample
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
APP_PORT=5000
DB_HOST=localhost
DB_PORT=5000
DB_USER=REPLACE_WITH_YOUR_USENAME
DB_PASSWORD=REPLACE_WIH_YOUR_PASSWORD
DB_NAME=REPLACE_BY_DB_NAME
JWT_SECRET=REPLACE_BY_JWT_SECRET
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
.env
41 changes: 41 additions & 0 deletions database.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
require("dotenv").config();

const mysql = require("mysql2/promise");

const database = mysql.createPool({
hots: process.env.DB_HOST,
port: process.env.DB_PORT,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
});

database
.getConnection()
.then(() => {
console.log("Can reach database");
})
.catch((err) => {
console.error(err);
});

database
.query("select * from movies")
.then(([movies]) => {
console.log(movies);
})
.catch((err) => {
console.error(err);
});

database
.query("select * from users")
.then(([users]) => {
console.log(users);
})

.catch((err) => {
console.error(err);
});

module.exports = database;
26 changes: 17 additions & 9 deletions express_quests.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- Active: 1698236999326@@127.0.0.1@3306@express_quests
DROP TABLE IF EXISTS movies;

CREATE TABLE movies (
Expand Down Expand Up @@ -63,51 +64,58 @@ CREATE TABLE users (
lastname varchar(255) NOT NULL,
email varchar(255) UNIQUE NOT NULL,
city varchar(255) DEFAULT NULL,
language varchar(255) DEFAULT NULL
language varchar(255) DEFAULT NULL,
hashedPassword varchar(255) DEFAULT NOT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;

INSERT INTO
users (firstname, lastname, email, city, language)
users (firstname, lastname, email, city, language, hashedPassword)
VALUES
(
'John',
'Doe',
'john.doe@example.com',
'Paris',
'English'
'English',
'$argon2id$v=19$m=16,t=2,p=1$emVmZXpmemZlemVmZWR6ZXplZg$rqZkhxu5YbqCGHPNrjJZpQ'
),
(
'Valeriy',
'Appius',
'valeriy.appius@example.com',
'valeriy.ppius@example.com',
'Moscow',
'Russian'
'Russian',
'$argon2id$v=19$m=16,t=2,p=1$emVmemVmemZlemZ6ZnpmZQ$eSetR6KPUNAGW+q+wDadcw'
),
(
'Ralf',
'Geronimo',
'ralf.geronimo@example.com',
'New York',
'Italian'
'Italian',
'$argon2id$v=19$m=16,t=2,p=1$emVmemVmemZlemZ6ZnpmZXphZGF6ZGQ$a0bg5DZB6H6v3jjQC81DXg'
),
(
'Maria',
'Iskandar',
'maria.iskandar@example.com',
'New York',
'German'
'German',
'$argon2id$v=19$m=16,t=2,p=1$emVmemVmemZlenplZHpkZnpmemZlemFkYXpkZA$V1qAnJDyMuuWG7g9yoGYXA'
),
(
'Jane',
'Doe',
'jane.doe@example.com',
'London',
'English'
'English',
'$argon2id$v=19$m=16,t=2,p=1$emVmemVmemZlenplZHpkZGZ6ZnpmZXphZGF6ZGQ$VCzq45PL9t8khtc44Kk5iw'
),
(
'Johanna',
'Martino',
'johanna.martino@example.com',
'Milan',
'Spanish'
'Spanish',
'$argon2id$v=19$m=16,t=2,p=1$emVmemVmemVmemZlenplZHpkZGZ6ZnpmZXphZGF6ZGQ$UKaGZ9hGFn/S5SBQDMe/Uw'
);
Loading