- Design and implement schema .
- Build Java based server & react client.
- Contract, end to end, and load test.
- Looking for the best practice for GraphQL project.
./gradlew build
cd buiild
java -jar libs/com-abc-api-xxxx.jar
Or
./gradlew bootRun
An example GraphQL Query might look like, and then you can adjust as per schema.
query{
boardings(flightNumber:"919") {
id
flight {
flightNumber
}
firstName
lastName
checkedIn
boardTime
boardingInfo
}
}
An example GraphQL Mutation
mutation {
board {
boardByName(firstName:"chuan",lastName:"chen", flightNumber:"919") {
id
flight {
flightNumber
}
firstName
lastName
checkedIn
boardTime
boardingInfo
}
}
}
-
- Request by Get http://127.0.0.1:8080/graphql?query={...}
http://127.0.0.1:8080/graphql?query={flights(flightNumber:"*") {id flightNumber}}
- Request by Post
mutation { flight { open(agentSineCode:"30033C", flightNumber:"800",departureAirport:"AKL") { id status gate flightNumber airlineOperatingCode seatMap { rowList { seatList { column type } } } } } }
All data and actions were based on mock method, it supports board / flight / boardings ... ... Prefer to send post request due to easily manage thing. Just try for fun!
- Switch input parameters to object with validattion
- Added more comment to understand definition
- Do we need airline operating code as input (such as: NZ, 3U, CA ...)? Default is NZ and only use flight number for now ("445", "101"...).
- Doesn't require depature date for all relevant methods for now due to simple style, and default today. May not right?
- Or for No.3/4, we can use id of flight which return from {flight.open}, and rest of call we can simply use this id instead of flight number
- error handling
- Logs
- Monitoring
No. | Issue | Solution |
---|
- Push this thing into containter, and deploy to Kubenetes in AWS.
- Setup OpenFaas on Kubernetes, and then write serverless code to invoke API.