Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
arawinters committed Jan 30, 2025
1 parent b576a32 commit 9e354c6
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ curl -X GET \
and paste the following in to the file:
```typescript
import { SzEnvironment } from '@senzing/sz-sdk-typescript-grpc';
const szEnvironment = new SzEnvironment({connectionString: `0.0.0.0:8261`});
import { SzGrpcEnvironment } from '@senzing/sz-sdk-typescript-grpc';
const szEnvironment = new SzGrpcEnvironment({connectionString: `0.0.0.0:8261`});

szEnvironment.product.getVersion().
then((result)=>{
Expand Down
46 changes: 46 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
## Running the examples from this repository

1. Install the dependencies required to build:

```console
npm install
```

2. Build the package locally:
```
make clean && make
```

3. Creat a npm link from the dist package directory so that the examples will reference the package in the `dist/@senzing/sz-sdk-typescript-grpc` as `@senzing/sz-sdk-typescript-grpc`. Go to the `dist/@senzing/sz-sdk-typescript-grpc` folder and type `npm link`.

4. Now go to the examples folder, `cd examples`, and type `npm link @senzing/sz-sdk-typescript-grpc` to link `@senzing/sz-sdk-typescript-grpc` -> `dist/@senzing/sz-sdk-typescript-grpc`.

5. From the examples directory any of the examples can be run by prefixing the relative filepath with `npm run `. For example, to run the `examples/szproduct/getVersion.ts` example simply type `npm run szproduct/getVersion.ts`. To run the getDataSources example type `npm run szconfig/getDataSources.ts`.


## Running the examples from your own project

1. Create a new TS project. If you already have a project created skip ahead to step 2.
```console
mkdir my-senzing-project && cd my-senzing-project &&
npx tsc --init
```

2. Add the `@senzing/sz-sdk-typescript-grpc` package to your project.
```console
npm install --save @senzing/sz-sdk-typescript-grpc
```

3. Copy examples and paste example code in to your project
```console
curl -X GET \
--output ./helloworld.ts \
https://raw.githubusercontent.com/senzing-garage/sz-sdk-typescript-grpc/refs/heads/main/examples/helloworld/helloworld.ts
```
4. and run:

```console
npx tsx helloworld.ts
```

0 comments on commit 9e354c6

Please sign in to comment.