pure JavaScript HTTP client/server
MIT License
Goal: Recreate an "Express" like framework using only:
Rationale: This closely approximates what would be required to do git HTTP requests over a pure WebRTC stream
npm start
node client.js
The HTTP server should echo the response, but capitalized.
The HTTP server should serve an HTML page (represented as an array of Uint8Arrays in server.js
), and a favicon image (represented as an async iterable stream via fs.createReadStream
in Node.js >= 10).
The HTTP server should return a text/plain message 'Hello, foobar!' to demonstrate that parsing and matching against path parameters in routes works.
A streaming parser means the data can be chopped arbitrarily in the transport layer.
A high-level async iterable API is exposed that is converted seamlessly to HTTP/1.1 chunked transfer-encoding to provide streaming control at the application layer.
An Express-like route registration API simplifies writing servers. Hopefully it can be quickly adapted to work over WebRTC and to work inside Service Workers.