Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

175
Vistas
HTTP POST request angular 13

I am trying to send a post http request to change the content of my file but when I do the post request, the log says error 404 the file does not exist. (http get worked on the same url). I have no idea why it does that, can someone help me?

bd.service.ts

const httpOptions = {
headers: new HttpHeaders({
'Content-Type':  'application/json',
'Authorization': 'my-auth-token'
 })
 };

postData(filename:string, data:any[]){
return this.http.post(filename,JSON.stringify(data),httpOptions);

recherche.component.ts

toggle(cpr:string){
this.bdService.lstLivres=this.livres;
this.bdService.togglePanier(cpr);

this.bdService.postData('http://localhost:4200/assets/data/panier.json',
this.bdService.getPanier()).subscribe(r=>console.log(r));
);
}

http://localhost:4200/assets/data/panier.json

    [{
        "id":1,
        "cpr":1,
        "aut":"Denis martin" ,
        "tit": "Manger a tout les jours",
        "pri": 75,
        "rab": 0.10,
        "des": "Comment lire à tout les jours et ne pas arrêter",
        "nic": "Secondaire",
        "img": "../assets/images/image2.jpg"
    },
    {
        "id":2,
        "cpr":2,
        "aut":"Denis martin" ,
        "tit": "Lire à tout les jours",
        "pri": 50,
        "rab": 0.10,
        "des": "Comment lire à tout les jours et ne pas arrêter",
        "nic": "Secondaire",
        "img": "../../assets/images/image2.jpg"
    },
    {
        "id":3,
        "cpr":3,
        "aut":"Denis martin" ,
        "tit": "Lire à tout les jours",
        "pri": 50,
        "rab": 0.10,
        "des": "Comment lire à tout les jours et ne pas arrêter",
        "nic": "Secondaire",
        "img": "../../assets/images/image2.jpg"
    }
]
about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda