This is my microservice for CS361. It will convert a csv file to json.
npm install
npm start
This is an Express app scaffolded from the express application generator
The '/upload-csv' route has been configured to accept a csv file and return a json.
axios({
method: "post",
url: apiUrl,
data: file,
headers: { "Content-Type": "multipart/form-data" },
})
.then((response) => {
// log response
console.log(response.data.data.convertedJson);
// add response to html text or textarea tag
document.querySelector("#json-display").value = JSON.stringify(
response.data.data.convertedJson
);
})
.catch((error) => {
console.log(error);
});
When launched, a gui is available at the home route '/'
Here you can choose a csv, upload it, and the returned JSON will be displayed in the text area.