Welcome to your Family Promise
. Use this to start your own Greenfield Project using java, spring, and common industry standards.
This repository assumes a handful of industry practices and standards. We strive to keep you on the bleeding edge of the industry and as a result, we have made some opinions for you so that you don't have to; you're welcome.
Labs teams must follow all Labs Engineering Standards.
awsaccesskey
- key to access aws instance local/deployedawssecretkey
- authorization token for aws instance (eg. SUPERSECRET)dynamodburl
- connection string for dynamo
See application-dev.properties for example values
To add pagination to your service and controller, follow these steps:
- Add a method named getAllExamplesPaginated that takes in two arguments: offset and limit.
- Implement the logic for fetching a paginated list of Example objects from your data source (e.g. database).
Example:
/**
* @param offset page index to return results from.
* @param limit number of results to include per page.
* @return returns a paginated list of Example objects.
*/
public Page<Example> getAllExamplesPaginated(int offset, int limit) {
return exampleRepository.findAll(PageRequest.of(offset, limit));
}
- Add a method named getAllExamplesPaginated that takes in two @PathVariable arguments: offset and limit.
- Call the getAllExamplesPaginated method from your service class, passing in the offset and limit arguments.
- Return the paginated results as a JSON response to the client.
Example:
/**
* @param offset page index to return results from.
* @param limit number of results to include per page.
* @return returns a paginated list of Example objects.
*/
@GetMapping("{offset}/{limit}")
public ResponseEntity<Page<Example>> getAllExamplePaginated(@PathVariable int offset, @PathVariable int limit) {
return ResponseEntity.ok(exampleService.getAllExamplesPaginated(offset, limit));
}