A project that implements a basic HTTP server, built using Java. It's meant to serve up both static and dynamic websites. The behavior of the server is verified using Cob Spec (see Run Acceptance Tests section below).
Clone this repository to your local machine
$ git clone https://github.com/bean00/http-server.git
$ cd http-server
Run the following command to run the unit tests:
$ mvn test
The acceptance test and instructions to run them can be found here
At the root dir run the command:
$ mvn package
- Run the command below from the root directory
- Pass in a flag and an argument for the directory to serve files from (
[-d DIRECTORY]
) - Pass in an *optional flag and argument for the port to listen on (
[-p PORT]
)- *The default port is 5000
- You can enter the arguments in any order
Proper usage:
$ java -jar [SERVER JAR FILE] [-d DIRECTORY]
$ java -jar [SERVER JAR FILE] [-p PORT] [-d DIRECTORY]
Example:
$ java -jar target/http-server-1.0-SNAPSHOT-jar-with-dependencies.jar -d public
$ java -jar target/http-server-1.0-SNAPSHOT-jar-with-dependencies.jar -p 8080 -d public