var express = require('express');
var router = express.Router();
var http = require('http');
router.get('*', function(req, res, next) {
http.get("http://steamcommunity.com/id/reminant/inventory/json/730/2",
function (response) {
response.on('data', function (data) {
var stringData = data.toString();
console.log(stringData);
res.render('index', { "data": stringData });
});
}).on('error', function (error) {
console.log(error);
});
});
Console:
Error: Can't set headers after they are sent.
at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:346:11)
at ServerResponse.header (e:\Users\Documents\Repositories\CSGOTest\node_modules\express\lib\response.js:718:10)
at ServerResponse.contentType (e:\Users\Documents\Repositories\CSGOTest\node_modules\express\lib\response.js:551:15)
at ServerResponse.send (e:\Users\Documents\Repositories\CSGOTest\node_modules\express\lib\response.js:138:14)
at done (e:\Users\Documents\Repositories\CSGOTest\node_modules\express\lib\response.js:957:10)
at Object.exports.renderFile (e:\Users\Documents\Repositories\CSGOTest\node_modules\jade\lib\index.js:374:12)
at View.exports.__express [as engine] (e:\Users\Documents\Repositories\CSGOTest\node_modules\jade\lib\index.js:417:11)
at View.render (e:\Users\Documents\Repositories\CSGOTest\node_modules\express\lib\view.js:126:8)
at tryRender (e:\Users\Documents\Repositories\CSGOTest\node_modules\express\lib\application.js:639:10)
at EventEmitter.render (e:\Users\Documents\Repositories\CSGOTest\node_modules\express\lib\application.js:591:3)