To build the JAR, enter ./mvnw clean package
.
This will create the JAR in the target
directory.
To run that JAR, enter java -jar target/fizz-buzz-java-app-0.0.1-SNAPSHOT.jar
.
Alternatively, you can run the application with Maven, by entering
./mvnw spring-boot:run
.
Once the application is running, go to http://localhost:8080/getPage to see the output.
An example of the response JSON object is shown below.
{
"values": [
{
"number": 11,
"fizz": false,
"buzz": false
},
{
"number": 12,
"fizz": true,
"buzz": false
},
{
"number": 13,
"fizz": false,
"buzz": false
},
{
"number": 14,
"fizz": false,
"buzz": false
},
{
"number": 15,
"fizz": true,
"buzz": true
}
]
}
Without specifying any optional request parameters, you are shown fizz buzz values for numbers 1 to 100.
Specify the page number with an optional pageNum
request parameter
e.g. http://localhost:8080/getPage?pageNum=100. Note that the first page is 0, and this is the default page.
Specify the number of values per page with an optional pageSize
request parameter
e.g. http://localhost:8080/getPage?pageSize=10. The default page size is 100.