Restful API implementation for polls.
These instructions will help you to set up the project and ready to be run with docker.
Prepare dependencies, docker images and generate image by using Dockerfile
-
Spring Boot 2.3.1.RELEASE
-
JDK 1.8
docker build -t pollapi .
docker run -d -p 8080:8080 pollapi
Now you can connect the API with localhost:8080. For example to see the API documentation under this url:
http://localhost:8080/swagger-ui.html
Service is defined in docker-compose.yml
so they can be run in an isolated environment.
docker-compose up
Now you can connect the API with localhost:8080. For example to see the API documentation under this url:
http://localhost:8080/swagger-ui.html
If the container is running the API swagger specification is available under this url:
http://localhost:8080/swagger-ui.html
-
Get poll list
Get full poll list in database
GET localhost:8080/polls/list
-
List all polls created by a user
Query polls created by a user
GET localhost:8080/polls/user=John%20Doe
-
Search polls by its title
Query polls by its title
GET localhost:8080/polls/title=Qui%20sont%20les%20superh%C3%A9ros%20Marvel%20les%20plus%20oufs?
-
List all polls created after a certain date
Query polls created after a certain date
GET localhost:8080/polls/dateAfter=1485521569055
-
Functionalities improvement
There are still some functionalities can be improved:
- Change date format to support real world usage format
- Support query combination
- Extend the DAO layer to support full shape of the polls in JSON format
-
Comprehensive testing
- More broader coverage testing, especially for exception handling
- Integration testing
-
Database
- Use PostgreSQL rather than H2 in-memory database
-
Exception handling
- More exception handling, ex: database time out etc.
Focused on the end-to-end software development process, according to following processes:
- Analysis and Planning Requirements
- Design and Prototyping
- Use SQL database
- Software Development
- Functionalities implementation
- JPA query
- Exception handling
- Testing
- Unit testing
- Deployment
- Dockerfile
- Docker-compose
- Maintenance and Updates
- Use Google Java code formatter
- DAO:
- Simple necessary JSON format ☑️
- Full JSON format
- Exception handling
- Global exception handler ☑️
- Runtime exception handler ☑️
- Database exception handler
- Database
- H2 in-memory database ☑️
- PostgreSQL database
- Query
- Simple query ☑️
- Query combination
- more flexible queries
- Testing
- Unit testing ☑️
- Integration testing
- End-to-end testing
- Documentation
- Logger ☑️
- Swapper API documentation ☑️
- Code style consistency:ballot_box_with_check:
- Docker
- Dockerfile ☑️
- Docker-Compose ☑️