Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 1.39 KB

README.md

File metadata and controls

29 lines (21 loc) · 1.39 KB

progress-banner

This is a starting point for JavaScript 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.

Along the way you'll learn about TCP servers, HTTP request syntax, and more.

How to

  1. Ensure you have node (18) installed locally
  2. Run ./your_server.sh to run your program, which is implemented in app/main.js.
  3. Start sending requests to your server using for example curl.

Routes

There are 5 routes, 4 of them are GET and one is a POST route.

  1. GET: / return 200.
  2. GET: /echo/<string> return 200, content-length, and the passed string as the response body.
  3. GET: /user-agent return 200, parse the user-agent from the request headers and return it as a response body.
  4. GET: /files/<file-name> return 200, the content of the passed file if exists, if not it return 404.
  5. POST: /files/<file-name> return 200, create a file with the provided name and the content of it grabs it from the request body.