My personal Practice Repo is also on CodeCrafters. You will not be able to access it though, but it's easy to get started on the CodeCrafters platform and tinker with various coding challenges.
Its results are posted here for a personal reference, and to share with those that might be interested in the approach I applied to make it work.
To test the server's functionality the CodeCrafters's HTTP Server Tester public repository was made available.
- Variation 1 - HTTP 1.2 Server with TypeScript
- Variation 2 - HTTP 1.2 Server With Python
- Variation 3 - HTTP 1.2 Server With C
- Variation 4 - HTTP 1.2 Server With Rust
Welcome to the Build Your Own HTTP Server challenge!
HTTP is the protocol that powers the web. In this challenge, you'll build an HTTP server that's capable of handling simple GET/POST requests, serving files and handling multiple concurrent connections.
Along the way, we'll learn about TCP connections, HTTP headers, HTTP verbs, handling multiple connections and more.
This is a starting point for TypeScript solutions to the "Build Your Own HTTP server" Challenge.
HTTP is the protocol that powers the web. In this challenge, you'll build a HTTP/1.1 server that is capable of serving multiple clients.
Further along, we'll also learn about TCP servers, HTTP request syntax, and more.
Note: If you're viewing this repo on GitHub, head over to codecrafters.io to try the challenge.
- This project contains various files of the main server logic for handling HTTP requests at different stages of development - main.ts through to main6.ts.
- It creates a TCP server that listens on port 4221 and handles GET and POST requests.
- The server can serve static files, echo back request paths, and return the User-Agent header value.
- The server requires a directory path to serve files from, which can be passed as a command line argument.
- The server can additionally
The entry point for your HTTP server implementation is in app/main.ts
. Study
and uncomment the relevant code, and push your changes to pass the first stage:
codecrafters test # Visit https://codecrafters.io/cli to install
They recommend using the CodeCrafters CLI, but you can use Git too.
git add .
git commit -m "pass 1st stage" # any msg
git push origin master
Time to move on to the next stage!
Note: This section example is for stages 2 and beyond.
- Ensure you have
bun (1.1)
installed locally - Run
$ ./your_program.sh
in a Bash Terminal to run your program, which is implemented inapp/main.ts
. - Commit your changes and run
git push origin master
to submit your solution to CodeCrafters. Test output will be streamed to your terminal.
More to come ...
More to come ...
More to come ...
More to come ...
References:
https://stackoverflow.com/a/74061022
https://docs.python.org/3/library/
http.server.html#http.server.BaseHTTPRequestHandler.end_headers
https://www.ibm.com/docs/en/cics-ts/beta?topic=protocol-http-responses
Add content ...
References:
Add content ...
References:
Add content ...
References:
Add content ...
References:
Add content ...
References:
Add content ...
References:
Add content ...
References: