Node.js server-side processing
Node.js server-side processing

Hi.
I'm trying to create a MEAN-stack application with datatables, but I need to use server-side processing. So far it works using client-side processing - setting server side: true isn't enough apparently
I've tried reading the ajax-request to get an understanding of how it should work, but it is empty. If I set the ajax source to data.json in datatables and use express like this:
router.get('/mongo/get', function(req, res, next) {
console.log(JSON.stringify(req.params))
// Connects to mongodb and sends back data.
}
the output is {} where I believe it should contain the data like draw, start, length etc.
The Datatables debuging is here http://debug.datatables.net/anujef. This claims that Data source is DOM and Processing is Client-side.
$(document).ready(function() {
var table= $('#pricesTable').DataTable( {
"processing": true,
"server-side": true,
"colReorder": true,
"select": true,
"autoWidth": true,
"dataSrc": "data",
"search": {
"regex": true},
"ajax": '/mongo/get/',
"columns": [...], ...
} );
So my question is: how should my node.js script handle the ajax-request, and why is it empty when server side processing is set to true.
Could you try to explain, or give examples of af node.js serverside script?
I know you would like a live example, but I haven't found a site to share mean-stack scripts from.
This question has an accepted answers - jump to answer
Answers
"serverSide" NOT "server-side".