便携式纯JavaScript ES6 HTTP库:eshttp
eshttp是一个便携式纯JavaScript ES6 HTTP库
设计目标:
- 纯JavaScript (ES6)
- high-performance and low-level, no stream abstractions
- portable, multiple backends support (Node/other platforms)
- fetch API frontend support
用法
Requires ES6 (io.js). Example web server using eshttp:
'use strict'; let eshttp = require('eshttp'); let HTTPServer = eshttp.HTTPServer; let HTTPResponse = eshttp.HTTPResponse; let server = new HTTPServer(); let response = new HTTPResponse(200, { 'x-header': 'value' }, 'hello'); server.onrequest = function(request) { request.respondWith(response); }; server.listen(8080); console.log('listening to port 8080');
本文由用户 loele 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!