Last commit ?
This commit is contained in:
parent
75060a0997
commit
34a5f703ea
9 changed files with 61 additions and 26 deletions
21
README.md
21
README.md
|
|
@ -1,5 +1,26 @@
|
|||
**Projet Chat**
|
||||
|
||||
**Instruction de lancement du Chat**
|
||||
- `docker compose up`
|
||||
- Puis se connecter en local sur `http://localhost:4200`
|
||||
- Le client ne se connecte pas pour l'instant. Mais le serveur démarre enfin, problème entre toutes les images docker,
|
||||
seul l'image des bases de données MongoDB et l'image du service-authentication marche. Les deux autres services
|
||||
ne marchent pas en image docker à cause du socket pour je ne sais quelle raison.
|
||||
|
||||
Pour lancer le projet sans image docker, il est obligatoire de lancer plusieurs terminals pour le frontend et pour chaque
|
||||
serveurs et avoir des images dockers mongodb.
|
||||
A savoir:
|
||||
- Terminal Frontend dans le dossier frontend : `ng serve`
|
||||
- Terminal service-authentication dans le dossier service-authentication : `node server.js`
|
||||
- Terminal service-message dans le dossier service-message : `node server.js`
|
||||
- Terminal service-privateroom dans le dossier service-privateroom : `node server.js`
|
||||
- Puis se connecter en local sur `http://localhost:4200`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Instruction du professeur**
|
||||
Le but du projet est de fournir un service de chat rudimentaire :
|
||||
- Une interface utilisateur en web
|
||||
- Les utilisateurs peuvent s'enregistrer/se connecter/se déconnecter/changer leur mot de passe
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ app.use(bodyParser.urlencoded({extended:true}));
|
|||
app.use(bodyParser.json());
|
||||
|
||||
const cors = require('cors');
|
||||
app.use(cors({origin: 'http://127.0.0.1:4200', credentials: true}));
|
||||
app.use(cors({origin: 'http://localhost:4200', credentials: true}));
|
||||
|
||||
const mongoConnect = require('./mongodbConnect');
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ function getSession (req, callback) {
|
|||
url: 'http://127.0.0.1:3000/verify:token',
|
||||
body: 'sessionid='+req.headers.cookie.replace('SESSIONID=','')
|
||||
},function (error, response, body) {
|
||||
console.log("body ; getSession auth message :",body);
|
||||
if(typeof body !== 'undefined'){
|
||||
const bodyJson = JSON.parse(body);
|
||||
if (bodyJson && bodyJson.status && bodyJson.data) {
|
||||
if (bodyJson.status === 'ok') {
|
||||
|
|
@ -15,6 +17,10 @@ function getSession (req, callback) {
|
|||
return callback(bodyJson.data.reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
return callback('Error');
|
||||
}
|
||||
});
|
||||
}
|
||||
return callback(undefined);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ const app = express();
|
|||
const server = http.createServer(app);
|
||||
const io = new Server(server, {
|
||||
cors: {
|
||||
origin: "http://127.0.0.1:4200",
|
||||
origin: "http://localhost:4200",
|
||||
methods: ["GET", "POST"],
|
||||
credentials: true
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ const io = new Server(server, {
|
|||
const port = process.env.PORT || 3001;
|
||||
|
||||
app.use(bodyParser.json());
|
||||
app.use(cors({origin: 'http://127.0.0.1:4200', credentials: true}));
|
||||
app.use(cors({origin: 'http://localhost:4200', credentials: true}));
|
||||
app.use(cookieParser());
|
||||
|
||||
|
||||
|
|
@ -114,6 +114,6 @@ io.on('connection',socket => {
|
|||
});
|
||||
});
|
||||
|
||||
server.listen(port, '0.0.0.0',() => {
|
||||
server.listen(port,'0.0.0.0', () => {
|
||||
console.log (`listening on port ${port}`);
|
||||
});
|
||||
|
|
@ -7,6 +7,8 @@ function getSession (req, callback) {
|
|||
url: 'http://127.0.0.1:3000/verify:token',
|
||||
body: 'sessionid='+req.headers.cookie.replace('SESSIONID=','')
|
||||
},function (error, response, body) {
|
||||
console.log("body ; getSession auth private :",body);
|
||||
if(typeof body !== 'undefined'){
|
||||
const bodyJson = JSON.parse(body);
|
||||
if (bodyJson && bodyJson.status && bodyJson.data) {
|
||||
if (bodyJson.status === 'ok') {
|
||||
|
|
@ -15,6 +17,10 @@ function getSession (req, callback) {
|
|||
return callback(bodyJson.data.reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
return callback('Error');
|
||||
}
|
||||
});
|
||||
}
|
||||
return callback(undefined);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ const { Server } = require("socket.io");
|
|||
const server = http.createServer(app);
|
||||
const io = new Server(server, {
|
||||
cors: {
|
||||
origin: "http://127.0.0.1:4200",
|
||||
origin: "http://localhost:4200",
|
||||
methods: ["GET", "POST"],
|
||||
credentials: true
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@ const cookieParser = require('cookie-parser');
|
|||
app.use(cookieParser());
|
||||
|
||||
const cors = require('cors');
|
||||
app.use(cors({origin: 'http://127.0.0.1:4200', credentials: true}));
|
||||
app.use(cors({origin: 'http://localhost:4200', credentials: true}));
|
||||
|
||||
const auth = require("./auth");
|
||||
|
||||
|
|
|
|||
|
|
@ -13,9 +13,11 @@ services:
|
|||
depends_on:
|
||||
- service-authentication
|
||||
- service-message
|
||||
- service-privateroom
|
||||
links:
|
||||
- service-authentication
|
||||
- service-message
|
||||
- service-privateroom
|
||||
|
||||
service-authentication:
|
||||
container_name: service-authentication
|
||||
|
|
@ -42,7 +44,7 @@ services:
|
|||
- backend/service-message
|
||||
- backend/service-message/node_modules
|
||||
ports:
|
||||
- 3001:3000
|
||||
- 3001:3001
|
||||
depends_on:
|
||||
- mongodb-message
|
||||
links:
|
||||
|
|
@ -58,7 +60,7 @@ services:
|
|||
- backend/service-privateroom
|
||||
- backend/service-privateroom/node_modules
|
||||
ports:
|
||||
- 3002:3000
|
||||
- 3002:3002
|
||||
depends_on:
|
||||
- mongodb-privateroom
|
||||
links:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
export const environment = {
|
||||
production: true,
|
||||
urlCL: 'http://127.0.0.1:3000',
|
||||
urlCG: 'http://127.0.0.1:3001',
|
||||
urlCPR: 'http://127.0.0.1:3002'
|
||||
urlCL: 'http://localhost:3000',
|
||||
urlCG: 'http://localhost:3001',
|
||||
urlCPR: 'http://localhost:3002'
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
export const environment = {
|
||||
production: false,
|
||||
urlCL: 'http://127.0.0.1:3000',
|
||||
urlCG: 'http://127.0.0.1:3001',
|
||||
urlCPR: 'http://127.0.0.1:3002'
|
||||
urlCL: 'http://localhost:3000',
|
||||
urlCG: 'http://localhost:3001',
|
||||
urlCPR: 'http://localhost:3002'
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
Reference in a new issue