Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

194
Views
Archivo de audio de visualización de Vue obtenido del backend de Express: audio/mp3

expresar punto final :

 app.get('/test', (request, response) => { response.sendFile("/absolute/path/to/file/myfile.mp3"); });

Prueba.vue :

 <template> <div> <p>test {{text}}</p> <audio controls="controls" src="./myfile.mp3"> </audio> </div> </template> <script> import axios from "axios"; export default { name: 'Test', data: function () { return { text: 'hello', audio: "" } }, created() { this.$watch( () => this.$route.params, () => { alert("fetching") this.fetchData() }, { immediate: true } ) }, methods: { fetchData() { axios.get('http://localhost:3000/test', { params: { } }) .then((response) => { alert("done") alert(JSON.stringify(response)); const url = URL.createObjectURL(response); alert(url); }); } } } </script>

Cuando cargo el Test.vue obtengo:

primera alerta :

ingrese la descripción de la imagen aquí

segunda alerta :

ingrese la descripción de la imagen aquí

tercera alerta :

ingrese la descripción de la imagen aquí

y luego aparece la página:

ingrese la descripción de la imagen aquí

Sé que necesito conectar la respuesta recibida de express al elemento <audio> , pero no estoy seguro de cómo hacerlo. Y noté que la alert(url) nunca se muestra (no aparece ninguna ventana de alerta).

Express está en localhost:3000 y Vue está en localhost:8080 . Cuando voy a http://localhost:3000/test , obtengo la página con el archivo de audio reproducible, por lo que Express backend hace su trabajo:

ingrese la descripción de la imagen aquí

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!