Skip to content

Commit 9038d1f

Browse files
Update readme
1 parent c5728b4 commit 9038d1f

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

README.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The NodeJS Lambda connector allows you to expose TypeScript functions as NDC functions/procedures for use in your Hasura DDN subgraphs.
44

5-
# How to Use
5+
## How to Use
66
First, ensure you have NodeJS v18+ installed. Then, create a directory into which you will create your functions using the `hasura-ndc-nodejs-lambda` Yeoman template.
77

88
```bash
@@ -14,3 +14,38 @@ npx yo hasura-ndc-nodejs-lambda
1414
This creates a `functions.ts` file in which you will write your functions, and a `package.json` with the `ndc-lambda-sdk` installed into it.
1515

1616
The `package.config` has been created with `start` and `watch` scripts. These use the SDK to host your `functions.ts` file. You can start your connector with `npm start`, or if you'd like it to automatically restart as you change your code, use `npm run watch`.
17+
18+
## Deploying with `hasura3 connector create`
19+
20+
You will need:
21+
22+
* [Hasura v3 CLI](https://hasura.io/docs/3.0/cli/installation/) (with a logged-in session)
23+
* [Hasura v3 CLI Connector Plugin](https://hasura.io/docs/latest/hasura-cli/connector-plugin/)
24+
* (Optionally) A value to use with `SERVICE_TOKEN_SECRET`
25+
* a TypeScript sources directory. E.g. `--volume ./my_functions_directory:/functions`
26+
27+
First, ensure you have deleted your `node_modules` directory from inside your sources directory, since that is unnecessary to deploy.
28+
29+
Then, create the connector:
30+
31+
```bash
32+
hasura3 connector create my-cool-connector:v1 \
33+
--github-repo-url https://github.com/hasura/ndc-nodejs-lambda/tree/main \
34+
--config-file <(echo '{}') \
35+
--volume ./my_functions_directory:/functions \
36+
--env SERVICE_TOKEN_SECRET=MY-SERVICE-TOKEN # (optional)
37+
```
38+
39+
*Note: Even though you can use the "main" branch to deploy the latest connector features, see the [Hasura Connector Hub](https://hasura.io/connectors/nodejs-lambda) for verified release tags*
40+
41+
Monitor the deployment status by name - this will indicate in-progress, complete, or failed status:
42+
43+
> hasura3 connector status my-cool-connector:v1
44+
45+
List all your connectors with their deployed URLs:
46+
47+
> hasura3 connector list
48+
49+
View logs from your running connector:
50+
51+
> hasura3 connector logs my-cool-connector:v1

0 commit comments

Comments
 (0)