Jelajahi Sumber

api frontend

formation 3 tahun lalu
induk
melakukan
191d7904b6

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

@@ -58,7 +58,7 @@ export class AuthService {
      //debugger;
      //debugger;
     console.log("url ========",this.apiUrl);
     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 => {
       .pipe(map(token => {
         // store jwt token in local storage 
         // store jwt token in local storage 
         localStorage.setItem('token', JSON.stringify(token));
         localStorage.setItem('token', JSON.stringify(token));
@@ -83,7 +83,7 @@ export class AuthService {
        //debugger;
        //debugger;
       console.log("url ========",this.apiUrl);
       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 => {
         .pipe(map(token => {
           // store jwt token in local storage 
           // store jwt token in local storage 
           localStorage.setItem('token', JSON.stringify(token));
           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;
 const db = config.url;
 
 
 //var db = 'mongodb://database_preprod:27017/mean-fatboar-db';
 //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(() => {
 .then(() => {
     console.log("Successfully connected to the database.");
     console.log("Successfully connected to the database.");
 }).catch(err => {
 }).catch(err => {