Pure Typescript HTTP Server based on Bun TCP sockets, from scratch.
Zero libraries, zero dependencies, zero ChatGPT, 100% man made and DIY.
This is a rewrite in Typescript using the native Bun TCP API of my solution to the "Build Your Own HTTP server" Challenge.
HTTP is the protocol that powers the web. In this challenge, you have to build a HTTP/1.1 server that is capable of serving multiple clients.
This server is build on top of native Bun 1.1 native API, avoiding its builtin HTTP Server (DIY or not?), meaning that it is a pure TCP server, and it can parse and serve concurrent HTTP request syntax requests, and more.
$ bun src/main.ts [--directory <staticFilesDirectory>]
OR
$ bun start [--directory <staticFilesDirectory>]Just bypass the Typescript transpilation by bundle sources into a unique compact javascript file:
$ bun run bundleThen start this file:
$ bun app/main.jsIf you want to distribute this program as a standalone executable binary, thanks to Bun, you can do it by:
$ bun run buildYou should now have an executable file named "http-server" at the root of your directory.