This project implements a CRUD API that handles airline documents from the travel-sample bucket provided by Couchbase.
Method |
URN |
Request Body |
Output |
Description |
POST | /airlines |
{
"id": 1234,
"type": "airline",
"name": "American Airlines",
"iata": "AA",
"icao": "AAL",
"callsign": "AMERICAN",
"country": "United States"
} |
{
"id": 1234,
"type": "airline",
"name": "American Airlines",
"iata": "AA",
"icao": "AAL",
"callsign": "AMERICAN",
"country": "United States"
} |
Create an airline |
GET | /airlines | - |
[
{
"id": 1234,
"type": "airline",
"name": "American Airlines",
"iata": "AA",
"icao": "AAL",
"callsign": "AMERICAN",
"country": "United States"
}
] |
Get all airlines |
GET | /airlines/:id | - |
{
"id": 1234,
"type": "airline",
"name": "American Airlines",
"iata": "AA",
"icao": "AAL",
"callsign": "AMERICAN",
"country": "United States"
} |
Get an airline by id |
PUT | /airlines/:id |
{
"id": 1234,
"type": "airline",
"name": "American Airlines",
"iata": "AA",
"icao": "AAL",
"callsign": "AMERICAN",
"country": "USA"
} |
{
"id": 1234,
"type": "airline",
"name": "American Airlines",
"iata": "AA",
"icao": "AAL",
"callsign": "AMERICAN",
"country": "USA"
} |
Update an airline by id |
DELETE | /airlines/:id | - | - | Delete an airline by id |
Code released under Apache License 2.0
- Install Couchbase Server (docs)
- Install travel sample bucket (docs)
- Set a configuration file called application.yaml with :
couchbase:
host: <COUCHBASE_SERVER_HOST>
username: <COUCHBASE_SERVER_USERNAME>
password: <COUCHBASE_SERVER_PASSWORD>
You can run your application in dev mode that enables live coding using:
./mvnw compile quarkus:dev
NOTE: Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8080/q/dev/.
The application can be packaged using:
./mvnw package
It produces the quarkus-run.jar
file in the target/quarkus-app/
directory.
Be aware that it’s not an über-jar as the dependencies are copied into the target/quarkus-app/lib/
directory.
The application is now runnable using java -Dquarkus.config.locations=<PATH_TO_CONFIG_FILE> -jar target/quarkus-app/quarkus-run.jar
.
If you want to build an über-jar, execute the following command:
./mvnw package -Dquarkus.package.type=uber-jar
The application, packaged as an uber-jar, is now runnable using java -Dquarkus.config.locations=<PATH_TO_CONFIG_FILE> -jar target/*-runner.jar
.