Skip to content

Commit 4821ef7

Browse files
Bump version, add basic readme
1 parent e8ef94d commit 4821ef7

File tree

3 files changed

+41
-6
lines changed

3 files changed

+41
-6
lines changed

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# ndc-nodejs-lambda
2+
3+
The NodeJS Lambda connector allows you to expose TypeScript functions as NDC functions/procedures for use in your Hasura DDN subgraphs.
4+
5+
# How to Use
6+
First create a `functions.ts` that contains your functions, for example:
7+
```typescript
8+
/**
9+
* @pure Exposes the function as an NDC function (the function should only query data without making modifications)
10+
*/
11+
export function hello(name?: string) {
12+
return `hello ${name ?? "world"}`;
13+
}
14+
```
15+
Then add a `configuration.json` file that simply contains an empty configuration object:
16+
```json
17+
{}
18+
```
19+
20+
Now add a `package.json` file that depends on the `ndc-lambda-sdk` like so:
21+
```json
22+
{
23+
"private": true,
24+
"scripts": {
25+
"start": "ndc-lambda-sdk host -f functions.ts serve --configuration configuration.json",
26+
"watch": "ndc-lambda-sdk host -f functions.ts --watch serve --configuration configuration.json"
27+
},
28+
"dependencies": {
29+
"@hasura/ndc-lambda-sdk": "0.2.0"
30+
}
31+
}
32+
```
33+
Now run `npm install` to install all the packages.
34+
35+
Notice the `start` and `watch` scripts in the `package.config`. 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`.

ndc-lambda-sdk/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ndc-lambda-sdk/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "@hasura/ndc-lambda-sdk",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"description": "SDK that can automatically expose TypeScript functions as Hasura NDC functions/procedures",
55
"author": "Hasura",
66
"license": "Apache-2.0",
7-
"homepage": "https://github.com/hasura/ndc-nodejs-lambda-connector#readme",
7+
"homepage": "https://github.com/hasura/ndc-nodejs-lambda#readme",
88
"bugs": {
9-
"url": "https://github.com/hasura/ndc-nodejs-lambda-connector/issues"
9+
"url": "https://github.com/hasura/ndc-nodejs-lambda/issues"
1010
},
1111
"bin": {
1212
"ndc-lambda-sdk": "bin/index.js"
@@ -25,7 +25,7 @@
2525
},
2626
"repository": {
2727
"type": "git",
28-
"url": "git+https://github.com/hasura/ndc-nodejs-lambda-connector.git"
28+
"url": "git+https://github.com/hasura/ndc-nodejs-lambda.git"
2929
},
3030
"dependencies": {
3131
"@hasura/ndc-sdk-typescript": "^1.2.7",

0 commit comments

Comments
 (0)