Configuration

Night mode

Running listUserOrders Query

A$AP GraphQL Server with NodeJS and MongoDB 🚀 Course

Engineers From These Top Companies and Universities Trust EXLskills

1M+ Professionals | 100+ Institutions

This is the EXLskills free and open-source GraphQL Server with NodeJS and MongoDB A$AP Course! It's a highly-accelerated open course that's best-suited for people with IT developer background in "legacy" technologies to quickly get up to speed with the content of the modern IT Dev Tool Chest, learn a concrete marketable hot skill and hit the ground running again!
After this course, you'll be able to apply modern development practices to building and deploying sophisticated backend software on popular platforms with huge demand for skilled resources! Convert your "legacy" experience into a hot modern skill A$AP. Get comfortable with Docker, container orchestration, Git, and dive into JavaScript code implementing a complete GraphQL server in NodeJS over MongoDB. On your laptop and in the Cloud.
For further practice, we recommend checking out our Guided Projects that will give you access to a professional developer, detailed documentation, and real-world tasks that you can work on to go from the basics into building production apps.

Is this course FREE?

Yes, this a 100% free course that you can contribute to on GitHub here!

Have more questions?

Viewing Data via GraphQL

Running listUserOrders Query

listUserOrders Query

With the GraphQL server running in node-dev container's shell, open a browser on the host and navigate to the GraphiQL tester http://localhost:8080/graph. Copy this query content (from doc/graphql-grahiql-samples.md, Queries, List User Orders) into the left pane of GraphiQL window (replacing the commented out instructions, if you haven't cleared them out before; although, you can leave the listUsers query in the pane):

Hit the "Execute Query" run-like looking button on the top bar, next to the GraphiQL logo, and select listUserOrders if you have more than one query in the pane. You should get this in the right (result) pane:

Everything looks familiar from the what we've already seen working with the listUsers query. Notice item_details represented as a JSON escaped (filled with \ as needed to preserve double quotes) string. This is by virtue of defining item_details as a GraphQLString in the Object Type. Unlike MongoDB, GraphQL requires object structures to be defined in order to display them as response fields. The closest we can get to a flexible structure output - by using GraphQLUnionType that enables a field to take one of the several pre-defined Object-like structures. However, in modern software a well formatted JSON is easily converted to an object, so the client should be able to work with this string just fine.

Next, let's take a look at the underlying code implementation for listUserOrders.