Node.js——请求头

var http = require('http')

var server = http.createServer();

server.on('request', function (req, res) {
    res.setHeader('Content-Type', 'text/plain;charset=utf8');
    res.write('hello 世界');
    res.end();
})

server.listen(8080, function () {
    console.log('server is running...')
})

 

posted @ 2018-06-14 09:36  var_obj  阅读(1640)  评论(0编辑  收藏  举报