https://github.com/clxrityy/http-server
A simple Java HTTP server
https://github.com/clxrityy/http-server
configuration http http-server java json
Last synced: 10 months ago
JSON representation
A simple Java HTTP server
- Host: GitHub
- URL: https://github.com/clxrityy/http-server
- Owner: clxrityy
- Created: 2024-11-05T21:24:52.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-02-17T15:26:59.000Z (about 1 year ago)
- Last Synced: 2025-03-30T07:32:12.817Z (about 1 year ago)
- Topics: configuration, http, http-server, java, json
- Language: Java
- Homepage:
- Size: 18 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HTTP Server
A simple Java HTTP server
## Usage
The files in [`root/`](/root/) will be served by the server.
- Simply run the `http-server.jar` file
```zsh
java -jar http-server.jar
```
- The server will start on port 5006 by default ([`http://localhost:5006`](http://localhost:5006))
- The server will serve files from the `root` directory by default
- The server will use the [`config.json`](/src/main/resources/config.json) file as the config by default
Test the `api/echo` route:
```zsh
curl -v \
-H "Content-Type: application/json" \
-d '{"message":"hello"}' \
http://localhost:5006/api/echo
```
Test for other file extensions:
```zsh
curl http://localhost:5006/style.css
```
> See all supported file extensions in the [`MimeTypes`](src/main/java/com/mjanglin/httpserver/config/MimeTypes.java) class.
## Features
- [x] JSON configuration management
- [x] HTTP server connection socket
- [x] HTTP server-to-client listener thread
- [x] Support for file types
- [x] Support for text files
- [x] Support for application
- [x] Support for audio files
- [x] Support for image files
- [x] Support for video files
- [x] Support for font files
- [x] ...
- [x] Support for routes
- [x] Support for different HTTP methods
- [x] GET
- [x] POST
- [ ] PUT
- [ ] DELETE
- [ ] PATCH
- [ ] Handle requests
- [x] Passing tests
- [x] Parsing headers of requests
- [ ] Parsing body of requests
- [ ] Parsing query parameters of requests
- [x] Thread pool support