We’re overhauling Dgraph’s docs to make them clearer and more approachable. If
you notice any issues during this transition or have suggestions, please
let us know.
Dgraph Lambda
Dgraph Lambda is a serverless platform for running JavaScript with Dgraph. You can download the latest version or review the implementation in the repo.Running with Docker
To run a Dgraph Lambda server with Docker:host.docker.internal doesn’t work on older versions of Docker on Linux. You
can use DGRAPH_URL=http://172.17.0.1:8080 instead.Adding libraries
If you would like to add libraries to Dgraph Lambda, usewebpack --target=webworker to compile your script.
Working with TypeScript
You can import@slash-graphql/lambda-types to get types for
addGraphQLResolver and addGraphQLMultiParentResolver.
Dgraph Alpha
To set up Dgraph Alpha, you need to define the--graphql superflag’s
lambda-url option, which is used to set the URL of the lambda server. All the
@lambda fields are resolved through the lambda functions implemented on the
given lambda server.
For example:
curl command:
Docker settings
If you’re using Docker, you need to add the--graphql superflag’s lambda-url
option to your Alpha configuration. For example:
/app/script/script.js file. Remember to set the DGRAPH_URL environment
variable to your Alpha server.
Here’s a complete Docker example that uses the base Dgraph image and adds Lambda
server support: