Devacron.com

Multifetch – NodeJS performance boost

Just came across a library for NodeJs which can give a nice small boost to our apps. What actually happens is eg. you are making one single GET request but you are getting back multiple Json responses. This can save time and resources. Have a look at the small example below:

var multifetch = require(‘multifetch’);
var express = require(‘express’);

var app = express();

app.get(‘/api/multifetch’, multifetch());

app.get(‘/api/user’, function(request, response) {
response.json({
name: ‘user_1’,
associates: [‘user_2’, ‘user_3’]
});
});

app.listen(8080);
To find more check this link: https://github.com/e-conomic/multifetch

Exit mobile version