sidebar_position | sidebar_label | description | keywords | |||||
---|---|---|---|---|---|---|---|---|
3 |
Add a lambda connector |
Learn how to add a lambda connector to expose custom business logic as part of your API. |
|
import Tabs from "@theme/Tabs"; import TabItem from "@theme/TabItem";
You can add a lambda connector just like any other data source.
ddn connector init <your_name_for_the_connector> -i
When you add the hasura/nodejs
connector, the CLI will generate a Node.js package with a functions.ts
file. This
file is the entrypoint for your connector.
As this is a Node.js project, you can easily add any dependencies you desire by running npm i <package-name>
from this
connector's directory.
When you add the hasura/python
connector, the CLI will generate a Python application with a functions.py
file. This
file is the entrypoint for your connector.
As this is a Python project, you can easily add any dependencies you desire by adding them to the requirements.txt
in
this connector's directory.
When you add the hasura/go
connector, the CLI will generate a Go application with a /functions
directory. The
connector will use this directory — and any *.go
file in it — as the entrypoint for your connector.
As this is a Go project, you can easily add any dependencies you desire by adding them to the go.mod
file and running
go mod tidy
from this connector's directory.
:::info Customization
You can customize which subgraph this connector is added to by
changing your project's context or using flags. More information can be found
in the CLI docs for the ddn connector init
command.
:::
After adding a connector, learn how to add custom business logic written in your language of choice and expose it via your API.