Mini GraphQL server for querying and mutating a small database of vehicles.
Historically I'm more familiar with consuming GraphQL APIs on the frontend (Apollo Client is awesome, by the way). Until recently, I hadn't yet created my own GraphQL server from scratch and so I thought it would be a fun learning experience. I've worked with Graphene in a Python/Flask app before, though I was curious to explore creating a Node/Express solution as well.
Shout out to mockaroo for making generation of mock data painless. 🦘
- Ensure that
Dockeris installed and running - In a terminal window at the project root, run
yarn install - Run
docker compose upto seed the database and start the Express server
While the server is running, the GraphiQL playground can be accessed in a web browser at http://localhost:3000/graphql.
{
getAllCars {
id
make
model
year
vin
}
}{
getCarById(id: "60e27002aed956ce6772d774") {
id
make
model
year
vin
}
}{
getCarsByMakeAndModel(make: "Acura", model: "TL") {
id
make
model
year
vin
}
}mutation {
createCar(
make: "Acura",
model: "TL",
year: 1998,
vin: "1D4PT5GK8BW557445"
) {
id
make
model
year
vin
}
}mutation {
updateCar(
id: "60e27002aed956ce6772d774",
make: "Acura",
model: "TSX",
year: 1998,
vin: "1D4PT5GK8BW557445"
) {
id
make
model
year
vin
}
}mutation {
deleteCar(id: "60e27002aed956ce6772d774") {
id
make
model
year
vin
}
}yarn startyarn lintyarn lint:fixyarn testyarn test:coverageyarn buildyarn cleanThe runtime environment for this application requires
node >= 14.15.0andyarn >= 1.22.4.
This application makes use of
ESLintandEditorConfig. Each of these features requires an extension be installed in order to work properly with IDEs and text editors such as VSCode.