Why Javascript for dgraph-lambda?

I was wondering why you went for javascript for dgraph-lambda? Couldn’t you just allow implementation of custom resolvers in golang?

Javascript just makes cross-platform-shipping of lambda functionality a real pain.

I think there are two main reasons:

  1. most of the users of GraphQL are frontend developers, and they do know javascript
  2. there are some advantages of using interpreted languages: you can store your logic as a data (in dgraph itself) and easily update it without recompilation/deployment.

Still, I would prefer lua as a script language.

You can check out my take on the lambda solution: https://github.com/miko/dgraph-luambda
There are examples of custom resolvers both in golang and lua.

Note: it is not production ready, just proof of concept.

1 Like