This repository is a web service that will return flights matching the specified criteria.
The web service will return:
- All flights
- All flights by airline code
- Provide the interface to create new flights
Software required to run this project is:
- IntelliJ IDEA (https://www.jetbrains.com/idea/download)
- Postman (https://www.postman.com/downloads)
If downloading the zip from this repository, firstly download, then unzip the file named "QtsWebService-main.zip".
Using IntelliJ IDEA, locate and open the directory named "QtsWebService-main".
- From the left project structure, expand "src->main->kotlin->com.flights.demo"
- Select "FlightsApplication.kt"
- From the menu select "Run->Run"
- In the presented dialogue options, select "FlightsApplication.kt"
The SpringBoot application server will start.
- Open Postman
- Import the following cURL statement:
curl --location --request POST 'http://localhost:8080/flight' \
--header 'Content-Type: application/json' \
--data-raw '{
"flightNumber":"QF401",
"airlineCode":"QF",
"departurePort":"MEL",
"arrivalPort":"SYD",
"departureTime":"2020-06-12T09:30:23Z",
"arrivalTime":"2020-06-12T10:25:23Z"
}'
- Within the Postman client, press Send.
To provide more data, the following data can be placed into the Body of the previous cURL statement and re-sent.
{
"flightNumber":"EK555",
"airlineCode":"EK",
"departurePort":"BKB",
"arrivalPort":"SYD",
"departureTime":"2020-06-12T09:30:23Z",
"arrivalTime":"2020-06-13T14:25:23Z"
}
{
"flightNumber":"QF400",
"airlineCode":"QF",
"departurePort":"ADL",
"arrivalPort":"SYD",
"departureTime":"2020-06-12T09:30:23Z",
"arrivalTime":"2020-06-12T11:30:23Z"
}
{
"flightNumber":"QF401",
"airlineCode":"QF",
"departurePort":"MEL",
"arrivalPort":"SYD",
"departureTime":"2020-06-12T09:30:23Z",
"arrivalTime":"2020-06-12T10:25:23Z"
}
{
"flightNumber":"AA111",
"airlineCode":"CX",
"departurePort":"ZWA",
"arrivalPort":"SYD",
"departureTime":"2020-06-13T11:30:23Z",
"arrivalTime":"2020-06-14T14:45:23Z"
}
{
"flightNumber":"AA222",
"airlineCode":"CX",
"departurePort":"ZWS",
"arrivalPort":"MEL",
"departureTime":"2020-06-15T13:30:23Z",
"arrivalTime":"2020-06-16T14:25:23Z"
}
- Import the following cURL statement:
curl --location --request GET 'http://localhost:8080/flight' \
- Press Send.
- import the following cURL statement:
curl --location --request GET 'http://localhost:8080/flight/QF' \
--header 'Content-Type: application/json' \
- Press Send.
- Change 'QF' to be a different airline code, such as CX.
- Press Send.
This solution could be run in a production environment such as AWS.
An AWS Elastic Beanstalk instance could be implemented that would provide instances of S3 and EC2 to support the Web Service in Spring Boot.