Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arpan-206/my-http-server
https://github.com/arpan-206/my-http-server
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/arpan-206/my-http-server
- Owner: Arpan-206
- Created: 2024-06-19T10:35:07.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-06-20T03:31:59.000Z (7 months ago)
- Last Synced: 2024-11-24T19:38:02.509Z (about 2 months ago)
- Language: Go
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HTTP Server
This is a simple proof of concept of a HTTP server written in Go.### How to run
1. Install Go
2. Clone this repository with `git clone https://github.com/Arpan-206/my-http-server.git`
3. Run `./your_server.sh --directory /tmp/` to start the server### How to connect
There are many routes you can connect to. Here are some examples:1. GET request to `http://localhost:4221/` will return a 200 status code without content.
2. GET request to `http://localhost:4221/echo/{some_text}` will return a 200 status code with the text you provided.
3. GET request to `http://localhost:4221/user_agent` will return a 200 status code with the user agent of the request.
4. GET request to `http://localhost:4221/files/{file_name}` will return a 200 status code with the content of the file you provided.
5. POST request to `http://localhost:4221/files/{file_name}` with a body will create a file with the content of the body and return a 200 status code.### How to look around the code
To look around the code, you can open the `app/server.go` file. This is where the server is defined and the routes are set up. Rest of the files are just helper files.