Skip to content

Commit

Permalink
Quickstart improvements (#159)
Browse files Browse the repository at this point in the history
* Remove redundant npm run build step in quickstart

* Improve service registration explanation

* Remove references to greeter name

* Expose port for psql state introspection in docker run command

* Remove references to Greeter

* Update docs/quickstart.mdx

Co-authored-by: Ahmed Farghal <[email protected]>

---------

Co-authored-by: Ahmed Farghal <[email protected]>
  • Loading branch information
gvdongen and AhmedSoliman authored Oct 24, 2023
1 parent c5f6047 commit 65aedc4
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions docs/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@ npx -y @restatedev/create-app && cd restate-node-template
First, get all dependencies and build tools. Then build the app:

```shell
npm install && npm run build
npm install
```

Now, you are all set to start developing your service in `src/app.ts`.
You can run the app with `ts-node-dev` while developing:
```shell
npm run app-dev
```

## Step 3: Build and Run the Greeter service
## Step 3: Build and Run the service
Once you have implemented your service, build the app and run it:
```shell
npm run build
Expand All @@ -51,10 +55,17 @@ Run the Restate Docker container:
docker run --name restate_dev --rm -d --network=host ghcr.io/restatedev/restate-dist:VAR::RESTATE_DIST_VERSION
```

Discover the services:
Register the service:

Now, we need to tell Restate where the service is running.
We do this by sending a request to the endpoint of the runtime at `http://localhost:8081/endpoints`
and providing it with the endpoint of the service `http://localhost:8080`.
```shell
curl -X POST http://localhost:9070/endpoints -H 'content-type: application/json' -d '{"uri": "http://localhost:9080"}'
```
Restate then sends a request to the service endpoint to ask which services and methods
are running behind this endpoint and will keep track of these (including of the method signatures).
After executing this curl request, you should see the discovered services and methods printed to your terminal.


</TabItem>
Expand All @@ -66,17 +77,23 @@ Run the Restate Docker container:
docker run --name restate_dev --rm -d -p 8080:8080 -p 9070:9070 -p 9071:9071 ghcr.io/restatedev/restate-dist:VAR::RESTATE_DIST_VERSION
```

Discover the services:
Register the services:

Now, we need to tell Restate where the service is running.
We do this by sending a request to the endpoint of the runtime at `http://localhost:8081/endpoints`
and providing it with the endpoint of the service `http://host.docker.internal:8080`.
```shell
curl -X POST http://localhost:9070/endpoints -H 'content-type: application/json' -d '{"uri": "http://host.docker.internal:9080"}'
```
Restate then sends a request to the service endpoint to ask which services and methods
are running behind this endpoint and will keep track of these (including of the method signatures).
After executing this curl request, you should see the discovered services and methods printed to your terminal.

</TabItem>
</Tabs>


## Step 5: Send requests to the Greeter service
## Step 5: Send requests to the service

Invoke the function via:

Expand Down

0 comments on commit 65aedc4

Please sign in to comment.