Leon df9ed504fd updated `README.md` | 7 년 전 | |
---|---|---|
src | 7 년 전 | |
.gitignore | 7 년 전 | |
README.md | 7 년 전 | |
pom.xml | 7 년 전 |
-
-
GET
method resembling the following:
http://blog.example.com/posts?page=3
-
http://blog.example.com/posts?page=3&size=20
-
-
JSON
object below.{
"data": [
... Blog Data
],
"totalPages": 9,
"currentPageNumber": 2,
"pageSize": 10,
"totalRecords": 90
}
-
Create a src/main/resource/import.sql
file with DML statements for populating the database upon bootstrap. The import.sql
should insert at least 10 polls, each with 3 or more options.
Below is an example of SQL
statements for creating a single poll with only one option.
Poll Creation
insert into poll (poll_id, question) values (1, 'What is your favorite color?');
Option Creation
insert into option (option_id, option_value, poll_id) values (1, 'Red', 1);
Restart your application.
Ensure database is populated by import.sql
.
Utilize Spring's built-in page number pagination support by researching the PagingAndSortingRepository
class.
Ensure the Controller
methods handle Pageable
arguments.
Send a GET
request to http://localhost:8080/polls?page=0&size=2
via Postman.
JSON
object with pagination-specific information.