- Use Spring Boot, Spring Data JPA and Hibernate to build a RESTful API
- Secure the API using a suitable sysem (ie using JWT etc)
- Use object-oriented programming to manage source code complexity
- Use an API client to test-drive code
It's time to use everything you've learned up to this point! Your task is to build a complete API in Java using Spring Boot, Spring Data JPA and Hibernate. Treat this challenge like a real project, not just an exercise to complete. Take time to read documentation, experiment & discuss ideas with your peers and teachers.
- Fork this repository
- Clone your fork to your machine
- Open the project in IntelliJ
- Navigate to the
src/main/resources/dirctory and rename theapplication.yml.examplefile toapplication.yml- Create a new PostgreSQL database for this exercise, a cloud database such as ElephantSQL is fine
- Replace the
DATABASE_URL,DATABASE_USERNAMEandDATABASE_PASSWORDsections in the .yml file with your real database information. An example of what the file should look like is below
- Your task is to develop the API that satisfies this API spec. Create your source code in the
com.booleanuk.api.cinemapackage
Pay close attention to the details of each endpoint. How you choose to implement the solution is up to you, there are no wrong answers, but the inputs and outputs must match the provided API documentation exactly.
You'll find an entity relationship diagram here. Use it to help you design your models.
The specification does not include any details of the authentication and security system which you will need to implement in the same way as you were shown during the morning session (ie using JWT and roles). For the roles you probably need to have an Admin role, a Customer role and any other suitable one you see fit to add to the system. Only authenticated users should be able to access the endpoints, only admin users should be able to add and update films and showings. Depending on how you choose to organise the roles and authentication system you may need to document this in your solution.
Example application.yml file:
server:
port: 4000
error:
include-message: always
include-binding-errors: always
include-stacktrace: never
include-exception: false
spring:
datasource:
url: jdbc:postgresql://tfke.db.elephantsql.com:5432/neondb
username: neondb_user
password: PFif40fj-eb6btfiF*k3nfEobyGaH
max-active: 3
max-idle: 3
jpa:
hibernate:
ddl-auto: update
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect
format_sql: true
show-sql: trueHere is an extension API spec.
It contains a few new routes, different approaches to data mutation and, most importantly, an entirely different response format for each request.
You'll need to do a fair amount of research in order to complete this challenge. Make liberal use of StackOverflow, search engines, YouTube and the teaching team.
Here are some reference documentation links that will be useful: