formation %!s(int64=4) %!d(string=hai) anos
pai
achega
b4758a0a27

+ 11 - 13
.vscode/launch.json

@@ -1,15 +1,13 @@
 {
-    // Utilisez IntelliSense pour en savoir plus sur les attributs possibles.
-    // Pointez pour afficher la description des attributs existants.
-    // Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387
-    "version": "0.2.0",
-    "configurations": [
-        {
-            "type": "pwa-chrome",
-            "request": "launch",
-            "name": "Launch Chrome against localhost",
-            "url": "http://localhost:8080",
-            "webRoot": "${workspaceFolder}"
-        }
-    ]
+  "version": "0.2.0",
+  "configurations": [
+      {
+          "name": "Run & debug my app on chrome",
+          "type": "chrome",
+          "request": "launch",
+          "url": "https://angular-preprod.foodgame.fr/",
+          "webRoot": "${workspaceFolder}",
+          "preLaunchTask": "start"
+      }
+  ]
 }

+ 1 - 1
angular-client/src/app/app.component.ts

@@ -9,5 +9,5 @@ export class AppComponent {
   title = 'fatboar';
 
   // Link to our api, pointing to api-preprod.foodgame.fr
-  API = 'https://api-preprod.foodgame.fr';
+  //API = 'https://api-preprod.foodgame.fr';
 }

+ 1 - 1
angular-client/src/app/components/login/login.component.ts

@@ -72,7 +72,7 @@ export class LoginComponent implements OnInit {
     this.loading = true;
    this.authService.signIn(this.formGroup.value).subscribe(
     data => {
-        // this.router.navigate([this.returnUrl]);
+         // this.router.navigate([this.returnUrl]);
         console.log(data)
         this.loading = false;
         this.router.navigate(['/auth']);

+ 4 - 0
docker-compose.yml

@@ -19,6 +19,8 @@ services:
     build: express-server
     ports:
       - "4000:4000"
+    environment:
+      - MONGO_URL=mongodb://database_preprod/fatboar  
     networks:
       - web
       - private
@@ -36,6 +38,8 @@ services:
       - traefik.http.routers.express_preprod.tls.certresolver=myresolver
     links:
       - database_preprod
+    depends_on: 
+      - database_preprod
     restart: always
 
   database_preprod:

+ 2 - 10
express-server/config/config.json

@@ -1,12 +1,4 @@
 {
-    "url": "mongodb+srv://henricarmelo:root@cluster0.cudfv.mongodb.net/test",
-    "secret_key": "api-fatboar-henri",
-    "reset_password_key": "passwordkey-fatboar_key",
-    "email": {
-        "user": "atangana29@gmail.com",
-        "pass": "atango",
-        "port" : 465,
-        "host" :"smtp.gmail.com"
-    },
-    "reset_password_url": "http://localhost:4200/login/reset-password"
+    "url": "mongodb+srv://henricarmelo:root@cluster0.cudfv.mongodb.net/test?retryWrites=true&w=majority"
+    
 }

+ 6 - 6
express-server/index.js

@@ -1,8 +1,8 @@
 const express = require('express');
 const bodyparser = require('body-parser');
 const mongoose = require('mongoose');
-// const cors = require('cors');
-// const config = require('./config/db.config');
+const cors = require('cors');
+const config = require('./config/db.config');
 const userRoutes = require('./routes/user');
 const employeeRoutes = require('./routes/employee');
 const authRoutes = require('./routes/auth');
@@ -38,10 +38,10 @@ app.get("/api", (req, res) => {
     res.status(200).send("Api Works.");
   });
 
- //var corsOptions = {
-    // origin: 'api-preprod.foodgame.fr',
-   // optionsSuccessStatus: 200 
-  //}
+ var corsOptions = {
+     origin: 'angular-preprod.foodgame.fr',
+    optionsSuccessStatus: 200 
+  }
 
 //Définition des CORS Middleware 
 app.use(function(req, res, next) {

+ 1 - 1
express-server/lib/db.js

@@ -3,7 +3,7 @@ const  config  = require('../config/config.json');
 
 //const db = config.url;
 
-var db = 'mongodb://database_preprod:27017/mean-fatboar-db';
+var db = 'mongodb://database_preprod:27017/fatboar';
 //var mongoURI = 'mongodb://localhost:27017/my-db';
 // mongoose.set('useCreateIndex', true)
 mongoose.connect(db, {useNewUrlParser: true, useUnifiedTopology: true })