proxy config

This commit is contained in:
imelilabourne 2020-09-15 16:14:45 +08:00
parent de41871af7
commit 247c891a09
6 changed files with 37 additions and 8 deletions

28
db.json
View File

@ -1,16 +1,40 @@
{
"tasks": [
{
"title": "Sleeping",
"title": "configure proxy config",
"completed": false,
"editing": false,
"id": 1
},
{
"title": "Dancing all day",
"title": "study routing",
"completed": false,
"editing": false,
"id": 2
},
{
"title": "go to the gym",
"completed": false,
"editing": false,
"id": 3
},
{
"title": "nap for 10 mins",
"completed": false,
"editing": false,
"id": 4
},
{
"title": "buy milk",
"completed": false,
"editing": false,
"id": 5
},
{
"title": "karaoke",
"completed": false,
"editing": false,
"id": 6
}
]
}

View File

@ -3,7 +3,7 @@
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"start": "ng serve --proxy-config proxyconfig.json",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",

7
proxyconfig.json Normal file
View File

@ -0,0 +1,7 @@
{
"/tasks":{
"target": "http://localhost:3000",
"secure": false,
"changeOrigin": true
}
}

View File

@ -43,7 +43,7 @@
<div>{{ remaining()}} uncompleted tasks</div>
</div>
<div *ngIf="atleastOneCompleted()">
<button class="btn btn-warning btn-block" (click) ="clearCompleted(); deleteCompleted(task)">Clear Completed</button>
<button class="btn btn-warning btn-block" (click) ="clearCompleted()">Clear Completed</button>
<div class="alert alert-warning">You've selected an item</div>
</div>

View File

@ -124,9 +124,7 @@ export class TodoList{
this.tasks = this.tasks.filter(task => !task.completed);
// this.todoService.deleteTask(tasks)
// .subscribe(data => this.tasks.filter(task => {
// return task == data;
// }))
// .subscribe(data => this.tasks.filter(task => !task.completed))
}
selectAll():void{

View File

@ -3,7 +3,7 @@ import { Injectable } from "@angular/core";
import { Observable } from "rxjs";
import { Tasks } from "../models/todo-interface";
import { map } from "rxjs/operators";
const URL = 'http://localhost:3000/tasks';
const URL = '/tasks';
@Injectable()
export class TodoService{
constructor(private http: HttpClient){}