I'm new to the nodeJS Express framework. I'm consuming a POST request that I sent using the following:
router.post('/', function(req, res) {
var data = Object.getOwnPropertyNames(req.body)[0];
});
I've sent this data from the client via:
$.ajax({
url: "write_to_region",
type: "POST",
data: JSON.stringify(grid)
});
where "grid" is a 2d array of values. My express body parser is configured as follows:
app.use(bodyParser.urlencoded({limit: '50mb', extended: false }));
What is a better or more idiomatic way of doing this? Note that the array is somewhat large (10kb) and contains only integers. Ideally, I would be minimizing the amount of data sent in the request. Thanks!!