1. 程式人生 > >nodejs -- 自定義頭部資訊

nodejs -- 自定義頭部資訊

var http=require('http');
http.createServer(function(req,res){
    console.log(req.headers);
    res.writeHead(200,{
        'content-Type':'text/plain',
        'aaaa':'wo'  //自定義頭部資訊
    });
    res.end("bbbbbbbbb");
}).listen(8888,'127.0.0.1');
console.log('server running at localhost:8888 ');