formation hace 3 años
padre
commit
191d7904b6
Se han modificado 2 ficheros con 6 adiciones y 5 borrados
  1. 2 2
      angular-client/src/app/services/auth.service.ts
  2. 4 3
      express-server/lib/db.js

+ 2 - 2
angular-client/src/app/services/auth.service.ts

@@ -58,7 +58,7 @@ export class AuthService {
      //debugger;
     console.log("url ========",this.apiUrl);
 
-    return this.http.post<Token>(`${this.apiUrl}/api/auth/login`, credentials)
+    return this.http.post<Token>(`/api/auth/login`, credentials)
       .pipe(map(token => {
         // store jwt token in local storage 
         localStorage.setItem('token', JSON.stringify(token));
@@ -83,7 +83,7 @@ export class AuthService {
        //debugger;
       console.log("url ========",this.apiUrl);
   
-      return this.http.post<Token>(`${this.apiUrl}/api/auth/admin`, credentials)
+      return this.http.post<Token>(`/api/auth/admin`, credentials)
         .pipe(map(token => {
           // store jwt token in local storage 
           localStorage.setItem('token', JSON.stringify(token));

+ 4 - 3
express-server/lib/db.js

@@ -8,9 +8,10 @@ const  config  = require('../config/config.json');
 const db = config.url;
 
 //var db = 'mongodb://database_preprod:27017/mean-fatboar-db';
-var mongoURI = 'mongodb://localhost:27017/my-db';
-//mongoose.set('useCreateIndex', true)
-mongoose.connect(db, {useNewUrlParser: true, useUnifiedTopology: true })
+//var mongoURI = 'mongodb://localhost:27017/my-db';
+mongoose.set('useCreateIndex', true)
+mongoose.connect(db, {useNewUrlParser: true, 
+    useUnifiedTopology: true })
 .then(() => {
     console.log("Successfully connected to the database.");
 }).catch(err => {