Inserting data into a database using node js mysql

This is my page.ts file. I want to insert the data to a database but it write “null” instead of the actual values. How can i correct it?

constructor(public http:HttpClient,public platform:Platform, public activatedRoute: ActivatedRoute, private formBuilder: FormBuilder, private navCtrl: NavController,private cartService: CartService, private modalCtrl: ModalController,private router: Router){
this.platform.ready().then(()=>{
this.cartAdd();
})
}

Database

Even an alternative way of doing it is fine.

Can you show the method cardAdd() please ?

cartAdd(){
var dataToSend = {
order_id:2,name:“kota”,price:57.96,qty:2,totalAmt:78
};
var url =“http://localhost:4000/add”;
this.http.post(url,{data:JSON.stringify(dataToSend)},{headers:new HttpHeaders(
{“content-Type”:“application/json”}
)}).subscribe(
(data)=>{
alert(data);
}
)
}

ow yes I forgot.

cartAdd(){
var dataToSend = {
order_id:2,name:“kota”,price:57.96,qty:2,totalAmt:78
};
var url =“http://localhost:4000/add”;
this.http.post(url,{data:JSON.stringify(dataToSend)},{headers:new HttpHeaders(
{“content-Type”:“application/json”}
)}).subscribe(
(data)=>{
alert(data);
}
)
}

you can test

cartAdd(){

const dataToSend = {
order_id: 2,
name :‘kota’,
price : 57.96,
qty : 2,
totalAmt: 78
}

const url = “http://localhost:4000/add”;
const headers = new HttpHeaders();
headers.set(‘Content-Type’, ‘application/json’);
this.http.post(url,dataToSend,{headers}).subscribe(
(data)=>{
alert(data);
});
}

remember import

import { HttpClient, HttpHeaders } from ‘@angular/common/http’;