Error: Can't set headers after they are sent.
at ServerResponse.OutgoingMessage.setHeader (http_outgoing.js:344:11)
at ServerResponse.header (C:\Users\TRANG\Desktop\30-8-2016\learn nodeJS\buoi
7\node_modules\express\lib\response.js:719:10)
at ServerResponse.location (C:\Users\TRANG\Desktop\30-8-2016\learn nodeJS\bu
oi7\node_modules\express\lib\response.js:836:15)
at ServerResponse.redirect (C:\Users\TRANG\Desktop\30-8-2016\learn nodeJS\bu
oi7\node_modules\express\lib\response.js:874:18)
at C:\Users\TRANG\Desktop\30-8-2016\learn nodeJS\buoi7\demologin.js:52:15
at Layer.handle [as handle_request] (C:\Users\TRANG\Desktop\30-8-2016\learn
nodeJS\buoi7\node_modules\express\lib\router\layer.js:95:5)
at next (C:\Users\TRANG\Desktop\30-8-2016\learn nodeJS\buoi7\node_modules\ex
press\lib\router\route.js:131:13)
at C:\Users\TRANG\Desktop\30-8-2016\learn nodeJS\buoi7\node_modules\body-par
ser\lib\read.js:129:5
at invokeCallback (C:\Users\TRANG\Desktop\30-8-2016\learn nodeJS\buoi7\node
modules\raw-body\index.js:262:16)
at done (C:\Users\TRANG\Desktop\30-8-2016\learn nodeJS\buoi7\node_modules\ra
w-body\index.js:251:7)
Best posts made by Người Lạ
-
Error: Can't set headers after they are sent. fix làm sao vậy mọi người ?
Latest posts made by Người Lạ
-
RE: Hỏi về Promise.all
@quanganh1202 sử dụng Promise.all([...]) thì nó sẽ chạy song song các phần tử trong mảng , khi 1 trong mảng bị bị reject thì sẽ nhảy vào .catch bắt lỗi
-
javascript multi-level menu help me!!!!
var nodes = [
{ idloai: 1, tenloai: 'The Thao', loaicha: 0 },
{ idloai: 2, tenloai: 'Giai Tri', loaicha: 0 },
{ idloai: 3, tenloai: 'Giao Duc', loaicha: 0 },
{ idloai: 4, tenloai: 'Dai Hoc', loaicha: 3 },
{ idloai: 5, tenloai: 'Du Hoc', loaicha: 3 },
{ idloai: 6, tenloai: 'Bong Da', loaicha: 1 },
{ idloai: 7, tenloai: 'Tennis', loaicha: 1 },
{ idloai: 8, tenloai: 'Boi Loi', loaicha: 1 },
{ idloai: 9, tenloai: 'Nhac Trong Nuoc', loaicha: 2 },
{ idloai: 10, tenloai: 'Nhac Quoc Te', loaicha: 2 },
{ idloai: 11, tenloai: 'MV Hay', loaicha: 2 },
{ idloai: 12, tenloai: 'nodejs', loaicha: 0 }
];function getMenu(f,c){
var a=[];
for(i=0; i<f.length; i++){
if(f[i].loaicha===c){
a.push({
id:f[i].idloai,
name:f[i].tenloai,
sub:getMenu(f,i)
});
}
}
return a;
}console.log(getMenu(nodes, 0));
error : Maximum call stack size exceeded
-
Error: Can't set headers after they are sent. fix làm sao vậy mọi người ?
Error: Can't set headers after they are sent.
at ServerResponse.OutgoingMessage.setHeader (http_outgoing.js:344:11)
at ServerResponse.header (C:\Users\TRANG\Desktop\30-8-2016\learn nodeJS\buoi
7\node_modules\express\lib\response.js:719:10)
at ServerResponse.location (C:\Users\TRANG\Desktop\30-8-2016\learn nodeJS\bu
oi7\node_modules\express\lib\response.js:836:15)
at ServerResponse.redirect (C:\Users\TRANG\Desktop\30-8-2016\learn nodeJS\bu
oi7\node_modules\express\lib\response.js:874:18)
at C:\Users\TRANG\Desktop\30-8-2016\learn nodeJS\buoi7\demologin.js:52:15
at Layer.handle [as handle_request] (C:\Users\TRANG\Desktop\30-8-2016\learn
nodeJS\buoi7\node_modules\express\lib\router\layer.js:95:5)
at next (C:\Users\TRANG\Desktop\30-8-2016\learn nodeJS\buoi7\node_modules\ex
press\lib\router\route.js:131:13)
at C:\Users\TRANG\Desktop\30-8-2016\learn nodeJS\buoi7\node_modules\body-par
ser\lib\read.js:129:5
at invokeCallback (C:\Users\TRANG\Desktop\30-8-2016\learn nodeJS\buoi7\node
modules\raw-body\index.js:262:16)
at done (C:\Users\TRANG\Desktop\30-8-2016\learn nodeJS\buoi7\node_modules\ra
w-body\index.js:251:7)