title: I have a todo app made by angular and the system sends some error
body: <p>When I want to post, the system sends the 405 error message back to the console.  I don't know how I made that, and how can I fix that.</p>
  
  <p>Or if I press the done button then the console will return a 500 error message.</p>
  
  <p>This is the HTML </p>
  
  <pre><code>&lt;input
    (keyup.enter)="createPost(name)" #name
    type="text" class="form-control"&gt;
  &lt;ul class="list-group"&gt;
    &lt;li
    *ngFor="let post of posts"
    [ngClass]="post.completed?'list-group-item list-group-item-success':'list-group-item'"&gt;
    &lt;button
      (click)="updatePost(post)"
      class="btn btn-outline-success btn-sm" id="button"&gt;
      {{ post.completed ? 'Done' : 'Not ready' }}
    &lt;/button&gt;
    &lt;button
      (click)="deletePost(post)"
      class="btn btn-outline-danger ml-2 btn-sm"&gt;
      Delete
    &lt;/button&gt;
    {{ post.name }}
    &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>And the TypeScript:</p>
  
  <pre><code>export class ToDoAppComponent {
    posts: any;
    private url = 'http://todoapp.test/api';
  
    constructor(private http: HttpClient) {
      http.get(this.url).subscribe(response =&gt; {
        this.posts = response;
      });
    }
  
  
  
    createPost(input: HTMLInputElement) {
      // tslint:disable-next-line: prefer-const
      let post: any = { name: input.value }
      input.value = '';
  
      this.http.post(this.url, JSON.stringify(post)).subscribe(response =&gt; {
        post.id = response.id;
        this.posts.splice(0, 0, post);
  
      });
    }
  
    updatePost(post) {
      this.http.put(this.url + '/' + post.id, JSON.stringify({ status: !post.status })).subscribe(response =&gt; {
        post.status = !post.status;
  
      });
    }
  
    deletePost(post) {
      this.http.delete(this.url + '/' + post.id, ).subscribe(response =&gt; {
        let index = this.posts.indexOf(post);
        this.posts.splice(index, 1);
      })
    }
  }
  </code></pre>
  
  <p>Attached is the error message and the data received by the server<a href="https://i.stack.imgur.com/vuk3z.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vuk3z.jpg" alt="enter image description here"></a><a href="https://i.stack.imgur.com/V96FV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/V96FV.jpg" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/zwvYr.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zwvYr.jpg" alt="enter image description here"></a></p>