A small experiment with bare-bones GraphQL. It's possible this experiment will be extended with Apollo GraphQL examples but for now, it's "just GraphQL".
npm install
npm start
open http://localhost:3413
Get all lines
{
lines {
id
name
}
}
Get line by id
{
line(lineId: "32") {
id
name
}
}
Add a stop
mutation addStop($stop: StopInput!) {
createStop(stop: $stop) {
id
name
}
}
// QUERY VARIABLES
{
"stop": {"stopId": "9000", "name": "Gent"}
}
In this example, a nested query is made so we can merge/enrich our request from different data sources.
{
EnrichedLines {
id
colors {
text
background
border
}
stops {
id
name
}
}
}
If you want to test this, make sure to swap simpleSchema
with advancedSchema
in graphql.controller.js
.
This project is open source and available under the MIT License.