I was stuck when trying to make a post request with Angular httpclient, here is the code I used to export data in Angular service:
/* UPLOAD_URL = "https:/semi.edu/uploadData" */
this.http.post(UPLOAD_URL, this.tracker.traverse_order).subscribe(
(response) => console.log(response),
(error) => console.log(error)
);
And this is the code I included in app.js (node.js file):
var db = require('./db');
var express = require('express');
var app = express();
app.post('/uploadData', bodyParser.json(), (req, res) => {
let insert_sql_statements = [...];
db.connection.query({
sql: 'INSERT INTO `collected_data` (articles) VALUES ?',
values: [insert_sql_statements]
});
And here is the error message:
And the server error log: