|
|
пре 9 година | |
|---|---|---|
| src | пре 9 година | |
| .gitignore | пре 9 година | |
| README.md | пре 9 година | |
| pom.xml | пре 9 година |
-
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 15 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.
Use Postman to ensure database is populated by import.sql.
org.springframework.data.repository.PagingAndSortingRepository.Controller methods to handle Pageable arguments.GET request to http://localhost:8080/polls?page=0&size=2 via Postman.
JSON object with pagination-specific information.