Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

177
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda