https://github.com/tknf/http-impl
Implementations of the web standard HTTP Request and Response
https://github.com/tknf/http-impl
Last synced: 3 months ago
JSON representation
Implementations of the web standard HTTP Request and Response
- Host: GitHub
- URL: https://github.com/tknf/http-impl
- Owner: tknf
- License: mit
- Created: 2022-08-07T18:48:21.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-10-02T16:43:22.000Z (over 3 years ago)
- Last Synced: 2025-03-04T11:43:26.301Z (over 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 291 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @tknf/http-impl
Implementations of the web standard HTTP Request and Response.
To get started, open a new shell and run:
```bash
npm install --save @tknf/http-impl
# or
yarn add @tknf/http-impl
```
## Getting started with Node.js
```js
const http = require("http");
const { createRequest, sendResponse } = require("@tknf/http-impl/node");
const server = http.createServer((req, res) => {
const request = createRequest(req);
const response = new Response("
Hello world!", {
headers: {
"Content-Type": "text/html;charset=utf-8"
}
});
await sendResponse(res, response);
});
server.listen(3000, () => {
console.log("Server listening on http://localhost:3000");
});