The REST API Reading Time Application is a Java-based application built with Spring Boot. It allows users to retrieve estimated reading times for texts or documents.
- Calculate estimated reading time for a given text or document.
- Supports various formats: plain text, Markdown, HTML, etc.
- Configurable reading speed.
- RESTful API for easy integration with other applications.
Before running the application, ensure you have the following dependencies installed:
- Java Development Kit (JDK) 8 or higher
- Maven
- Clone the repository or download the source code.
- Open a terminal and navigate to the project directory.
- Run the following command to build the project:
mvn clean install
- After a successful build, start the application:
java -jar target/reading-time-api.jar
Endpoint: /api.readingtime/v1
Method: POST
json
{ "title" : "The big bang theory" "body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit." }
Response:
{ "readingTime": { "minutes": 1, "seconds": 30 } }
The application provides the ability to configure the reading speed (words per minute). By default, the reading speed is set to 200 words per minute.
To modify the reading speed, open the application.properties file and update the following property:
app.reading-speed=200
You can use any HTTP client to interact with the API endpoints. Here are a few examples using curl:
- Calculate reading time for a text file:
curl -X POST -H "Content-Type: application/json" -d '{"text": "Lorem ipsum dolor sit amet."}' http://localhost:8080/api.readingtime/v1
- Calculate reading time for an HTML document:
curl -X POST -H "Content-Type: application/json" -d '{"text": "<h1>Lorem ipsum</h1><p>Dolor sit amet.</p>"}' http://localhost:8080/api.readingtime/v1
Contributions are welcome! If you would like to contribute to this project, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Commit your changes and push the branch to your fork.
- Submit a pull request with a description of your changes.
This project is licensed under the MIT License.
Feel free to customize the README file as per your specific application requirements and add any additional sections that might be relevant