This repository showcases the implementation of a highly optimized HTTP server, designed to meet the specific requirements outlined by Headout. The server is written in Javascript + (Node.js & Express.js), and the entire application is bundled into a Docker image named Dockerfile.
|-- app.js # Source code for the HTTP server
|-- tmp/ # Placeholder for data files
|-- data/
|-- 1.txt # Testing File 1
|-- 2.txt # 100 MB Testing File 2
|-- Dockerfile # Dockerfile for bundling the application
|-- README.md # Project README file
- Clone the repository.
- Navigate to the root directory.
- Review the source code in the
app.jsfile for the HTTP server implementation. - Examine the
Dockerfilefor Docker image configuration.
docker compose updocker compose down- Implements a robust HTTP server responding to GET requests on the
/dataendpoint. - Supports query parameters:
n: File namem: Line number
- Adheres to the following rules:
- If both
nandmare provided, it returns the content of the file/tmp/data/n.txtat line numberm. - If only
nis provided, it returns the entire content of the file/tmp/data/n.txt.
- If both
- Efficiently handles files of approximately 100MB in size.
- More than 30 different files, ranging from 1.txt to n.txt.
- The server is bundled into a Docker image named
Dockerfile. - The Dockerfile is compatible with both ARM architecture and x86.
- Exposes port 8080.
- Configured to allocate a maximum of 1500 MB RAM and 2000m/2 Core CPU for the Docker container.
