send-json:Node.js 模块通过 http 将对象作为 JSON 发送

时间:2021-07-12 19:40:11
【文件属性】:
文件名称:send-json:Node.js 模块通过 http 将对象作为 JSON 发送
文件大小:3KB
文件格式:ZIP
更新时间:2021-07-12 19:40:11
JavaScript 发送-json 通过 http 将对象作为 JSON 发送。 例子 var http = require ( 'http' ) ; var sendJson = require ( 'send-json' ) ; var server = http . createServer ( function ( req , res ) { sendJson ( res , { hello : 'world' } ) ; } ) ; server . listen ( 3000 ) ; 或者您可以像这样向 http 响应对象添加一个send函数。 var http = require ( 'http' ) ; var sendJson = require ( 'send-json' ) ; var server = http . createServer ( function ( re
【文件预览】:
send-json-master
----.gitignore(13B)
----package.json(620B)
----.travis.yml(94B)
----index.js(314B)
----test.js(498B)
----LICENSE.txt(1KB)
----README.md(706B)

网友评论