|
@@ -1,4 +1,3 @@
|
1
|
|
--
|
2
|
1
|
# Pagination
|
3
|
2
|
* To optimize performance, it is important to limit the amount of data returned, especially in the case of a mobile client.
|
4
|
3
|
* REST services have the ability to give clients access large datasets in manageable chunks, by splitting the data into discrete pages or _paging data_.
|
|
@@ -44,7 +43,7 @@
|
44
|
43
|
-
|
45
|
44
|
# Taking Action!
|
46
|
45
|
|
47
|
|
-0. Create a `src/main/resource/import.sql` file with [DML statements](http://lmgtfy.com/?q=DML+statement) for populating the database upon bootstrap. The `import.sql` should insert at least 10 polls, each with 3 or more options.
|
|
46
|
+1. Create a `src/main/resource/import.sql` file with [DML statements](http://lmgtfy.com/?q=DML+statement) for populating the database upon bootstrap. The `import.sql` should insert at least 10 polls, each with 3 or more options.
|
48
|
47
|
* Below is an example of `SQL` statements for creating a single poll with only one option.
|
49
|
48
|
|
50
|
49
|
* Poll Creation
|
|
@@ -58,9 +57,9 @@
|
58
|
57
|
insert into option (option_id, option_value, poll_id) values (1, 'Red', 1);
|
59
|
58
|
```
|
60
|
59
|
|
61
|
|
-0. Restart your application.
|
62
|
|
-* Ensure database is populated by `import.sql`.
|
63
|
|
-* Utilize Spring's built-in page number pagination support by researching the `PagingAndSortingRepository` class.
|
64
|
|
-* Ensure the `Controller` methods handle `Pageable` arguments.
|
65
|
|
-* Send a `GET` request to `http://localhost:8080/polls?page=0&size=2` via Postman.
|
66
|
|
- * Ensure the response is a `JSON` object with pagination-specific information.
|
|
60
|
+2. Restart your application.
|
|
61
|
+3. Ensure database is populated by `import.sql`.
|
|
62
|
+4. Utilize Spring's built-in page number pagination support by researching the `PagingAndSortingRepository` class.
|
|
63
|
+5. Ensure the `Controller` methods handle `Pageable` arguments.
|
|
64
|
+6. Send a `GET` request to `http://localhost:8080/polls?page=0&size=2` via Postman.
|
|
65
|
+ * Ensure the response is a `JSON` object with pagination-specific information.
|