timcash / small_http

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

small_http 初心

Motivation

  1. This system is designed to be readable and hackable.
  2. Framworks import so many tools and technologies that they form islands of code. Hiding the underlying simplicity.
  3. To have a small piece of code to learn about networking and the http (protocol)

Non-features

A small set of tools to get started with a nodejs http server. More like a template.

  1. server uses node:http
  2. great for learning about testing and http servers at a lower level
  3. easy to inspect and modify the raw streams
  4. testing uses the built in node:test and undici for requests for compatibility with other runtimes
  5. examples of async and stream styles in a running server (node.js superpower)

install

install npm if needed

npm install

test

run the test suite in watch mode

npm test

Completed PRs

  1. HTTP Only Cookie example

Looking for PRs

  1. Improve clarity of docs.
  2. Start a mods folder that can add websockets and sse.
  3. Add html page examples for forms and uploads.
  4. Add autoreload when a page changes

external test tools

Including a few external testing tools to help learn about the larger web ecosystem and popular testing strategies.

  1. playwright https://github.com/microsoft/playwright
  2. nodemon https://github.com/remy/nodemon
  3. undici https://github.com/nodejs/undici

About


Languages

Language:JavaScript 98.7%Language:HTML 1.3%