は、次の例を考えてみましょう:シンプルなWebサーバーの例 - プロパティ名を引用符で囲む必要があるのはなぜですか?
var http = require('http');
var server = http.createServer(function(request, response) {
response.writeHead({
'content-type': 'text/plain'
});
response.end('Hello world!');
});
server.listen(8000);
は、私は引用符にcontent-type
プロパティ名を入れなければならないのはなぜ? writeHeadが普通のJSオブジェクトを期待していませんか?なぜ私が何か書くことはできません。
{
content-type: 'text/plain'
}