I'm using TypeScript for this and Express, along with Curl for the POST request. Everytime I try to use the POST request using Curl, it always returns undefined
.
The function listOfSplashNumbers
is a function that takes in an array which contains 9 arrays and a triple.
Something like: "visualisation": '[[5535,2145],[0021,8875],[2135,8774],[2135,8774],[2135,8774],[2135,8774],[2135,8774],[2135,8774],[2135,8774],[2135,8774, 0854]]'
const app = express();
app.use(express.json());
app.post("/visualize", (req, res) => {
const visualisation = req.body.visualisation;
console.log(visualisation); //Returns undefined
const splash = listOfSplashNumbers(visualisation);
});
My Curl command looks like this:
curl http://localhost:5000/visualize \ --request POST \ --header "Content-Type: application/json" \ --data '{"visualisation":[[5535,2145],[0021,8875],[2135,8774],[2135,8774],[2135,8774],[2135,8774],[2135,8774],[2135,8774],[2135,8774],[2135,8774, 0854]]}';