To upload the audio to our server, we are using postFile() on audioAPIService. Let's create this service now. Inside the client/app/services folder, create a file name audio.api.service.ts and update it, as shown here:
// SNIPP SNIPPimport { Injectable } from '@angular/core';import { HttpClient } from '@angular/common/http';import { Observable } from 'rxjs/Observable';@Injectable()export class AudioAPIService { constructor(private http: HttpClient) {} postFile(threadId: string, audioBlob: File): Observable < any > { const formData: FormData = new FormData(); formData.append('audio-reply', audioBlob, audioBlob.name); return this.http.post < any > (`/api/upload-audio/${threadId}`, formData); }}// SNIPP SNIPP