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

176
Views
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
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!