This project is a simple Java-based HTTP server that serves random motivational quotes via a REST API. The quotes are externalized to a quotes.txt file for easy customization.
- Serves random motivational quotes in JSON format.
- Uses an external quotes.txt file for configurable quotes.
- Dockerized for easy deployment.
- Java 17+
- Maven (if building from source)
- Docker (for containerized deployment)
- Clone the repository:
git clone https://github.com/dsusmit63/java-quotes-app.git
cd java-quotes-app
- Ensure quotes.txt exists in the project directory and contains quotes (one per line).
- Compile and run the application:
javac src/Main.java -d out
java -cp out Main
- The server will start on http://localhost:8000
- Build the docker image:
docker build -t java-quotes-app:latest .- Run the container:
docker run -d -p 8000:8000 --name java-quotes-app java-quotes-app:latest- Access the application at http://localhost:8000
project-root/
│── src/
│ └── Main.java
│── quotes.txt
│── Dockerfile
│── README.md
│── target/
│ └── myapp.jar (if using Maven build)To customize the quotes, edit quotes.txt and restart the application. Each quote should be on a new line.