| .mvn/wrapper | ||
| src | ||
| .gitignore | ||
| mvnw | ||
| mvnw.cmd | ||
| pom.xml | ||
| ReadMe.md | ||
Flight Booking API Application
SpringBoot Application that demonstrates REST API Development using Spring MVC, Spring Data JPA using Java 8 features
Features
This application has two primary REST end-points that provide flight-booking information.
- GET /bookings?uid={passenger-id}
- GET /bookings/{booking-id}
Besides these two primary end-points, there are few other end-points to support the consumer apps(mobile/web). They are:
- GET /airports
- GET /airports/{iata-code}
- GET /flights
- GET /flights/{flight-id}
- GET /passengers
- GET /passengers/{passenger-id}
To test these end-points, see the API documentation section here
Technologies used
- Java (Programming Language)
- Spring Boot (Application Platform)
- Spring Data JPA (Data persistence)
- H2 (Database)
- JUnit, with Spring Testing (Unit & Integration Testing)
Getting Started
The source code can be checked out to your local and then build and run the application either from your IDE after importing to it as a maven project, or just from a command line. Follow these steps for the command-line option:
Prerequisites
- Java 8
- Maven 3
- Git
Installing & Running
Clone this repo into your local:
git clone https://sameerean@bitbucket.org/sameerean/flight-booking.git
Build using maven
mvn clean install
Start the app
mvn spring-boot:run
Access the Home screen
The application will be available at the URL: Home.
The home screen will give you relevant links to navigate, including the API end-points.
Test the URLs
1. [http://localhost:8080/bookings?uid=PS-10](http://localhost:8080/bookings?uid=PS-10)
2. [http://localhost:8080/bookings/FB-10](http://localhost:8080/bookings/FB-10)
API Documentation and Integration Testing
API documentation can be accessed via Swagger UI
Running the Test Cases
There is just one test case for this project as of now: BookingTest.java
You can run it either from:
- Command line
mvn test
-
Your IDE
Right click on this file and "Run As JUnit Testcase"
Database
This application is using H2 in-memory database, which (database as well as data) will be removed from memory when the application goes down.
While the application is running, you can access the H2 Console if you want to see the data outside the application.
You can connect to the DB using the JDBC URL: 'jdbc:h2:mem:flight-booking' and user 'sa' with NO password.
Data pre-loading
Sample data is pre-loaded from the demonstration purpose by DataLoader.java. In a production-grade application, this will be done through a database upgrade script/task.