This is a Node + GraphQL server that calls SpaceX API, to fetch some launches and rockets data.
This is just a POC (proof of concept), so a few tests could be missing, but I'll try to add as many tests cases as possible to understand how to test a Node GraphQL server.
It's written in Node 10.5.0 with expressjs and express-graphql.
Run the following command to install all necessary dependencies.
This will run the server in development mode with nodemon at http://localhost:4000/graphql.
In development GraphiQL will be available to run and test the queries.
Will run all application tests in watch mode.
For tests it's using Jest.
These are the available schemas mapped from SpaceX API. You can add as many properties as you want to these available schemas to fetch more data and create new schemas and resolvers to fetch different data.
type Launch {
flight_number: Int
mission_name: String
launch_year: String
launch_date_local: String
launch_success: Boolean
rocket: Rocket
}
type Rocket {
rocket_id: String
rocket_name: String
rocket_type: String
}
type Query {
launches: [Launch]
launch(flight_number: Int!): Launch
rockets: [Rocket]
}