Skip to content

Commit ac24e11

Browse files
committed
linking local server to localhost:4200
1 parent 8da1aea commit ac24e11

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.0.0",
44
"scripts": {
55
"ng": "ng",
6-
"start": "ng serve --host=127.0.0.1",
6+
"start": "ng serve --proxy-config ./proxy.json --host=127.0.0.1",
77
"build": "ng build",
88
"test": "ng test",
99
"lint": "ng lint",

src/app/courses/courses.service.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,14 @@ export class CoursesService {
1717
loadCourses(): Observable<Course[]> {
1818
const params = new HttpParams().set("page", "1").set("pageSize", "10");
1919

20-
return this.http.get<Course[]>("http://localhost:9000/api/courses", {
20+
return this.http.get<Course[]>("api/courses", {
2121
params,
2222
});
2323
}
2424

2525
saveCourse(course: Course) {
2626
const headers = new HttpHeaders().set("X-Auth", "userId");
2727

28-
return this.http.put(
29-
`http://localhost:9000/api/courses/${course.id}`,
30-
course,
31-
{ headers }
32-
);
28+
return this.http.put(`api/courses/${course.id}`, course, { headers });
3329
}
3430
}

0 commit comments

Comments
 (0)