A basic HTTP server written in Node.js using the net
and fs
modules.
This project is a simple HTTP server implemented in Node.js that handles basic GET and POST requests. It serves as a starting point for building more complex web applications.
- Handles basic
HTTP
GET
andPOST
requests. - Supports serving static files.
To use this server, follow the installation steps below. Once the server is running, you can send HTTP requests to test its functionality.
-
GET /: Responds with a basic "200 OK" message.
-
GET /echo<content>: Responds with the provided content.
-
GET /user-agent: Responds with the User-Agent header from the request.
-
GET /files<filename>: Responds with the content of the specified file.
-
POST /files<filename>: Writes the content of the POST request body to the specified file.
-
Clone the repository:
git clone https://github.com/your-username/your-repository.git cd your-repository
-
Install Dependencies
npm install
-
Run The Server
node server.js /path/to/directory
Replace /path/to/directory
with the path where you want to store uploaded files.