Querying a Geographical Database with GraphQL

  1. I hate REST APIs
  2. I love GraphQL

Project Setup (annoying)

mkdir DopeGraphQLServercd DopeGraphQLServernpm init
  1. .eslintrc
  2. .flowconfig

Lets build a GraphQL Server

Sike! We’re just going to lean on my favorite GraphQL Server, the Apollo Server!

Schema Time

In GraphQL a “schema” represents the defined set of data the server supports. This is one of the best things about GraphQL, a schema enforced by a Type System. This way your clients will always have a guarantee on data in a specific format.

Resolver time


A connector is the piece of code that links a GraphQL server to a specific backend. In our case, the backend here is the GeoNames API.


Well that was fun and I hope was a great introduction to a simple alternative to Rest APIs. We went over the pieces you need to get started with GraphQL and built a cool little data source.

What’s next?

Let’s get some community PR’s to this repo, expanding the search options and then hook a UI up to it. I’ll probably use this repo for further posts so at the end of the day we have crazy amount of resolvers. Once we have a bunch of stuff hooked up, we’ll go over hosting options



Software Engineer at Workpop, Inc.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abhi Aiyer

Abhi Aiyer

Software Engineer at Workpop, Inc.