Skip to content

Commit

Permalink
Update default port to 9080 (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
slinkydeveloper authored Sep 29, 2023
1 parent 7630bfb commit 5acc5ec
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const addToCart = async (ctx: restate.RpcContext, cartId: string /* the key */,
restate
.createServer()
.bindKeyedRouter("cart", restate.keyedRouter({ addToCart, expireTicket }))
.listen(8080);
.listen(9080);
```

Restate takes care of:
Expand Down Expand Up @@ -109,19 +109,19 @@ Start the runtime in a Docker container and tell Restate about the example servi
```shell
docker run --name restate_dev --rm --network=host ghcr.io/restatedev/restate-dist:latest

curl -X POST http://localhost:8081/endpoints -H 'content-type: application/json' -d '{"uri": "http://localhost:8080"}'
curl -X POST http://localhost:9070/endpoints -H 'content-type: application/json' -d '{"uri": "http://localhost:9080"}'
```
- On macOS:
```shell
docker run --name restate_dev --rm -p 8081:8081 -p 9091:9091 -p 9090:9090 ghcr.io/restatedev/restate-dist:latest
docker run --name restate_dev --rm -p 9070:9070 -p 8080:8080 ghcr.io/restatedev/restate-dist:latest
curl -X POST http://localhost:8081/endpoints -H 'content-type: application/json' -d '{"uri": "http://host.docker.internal:8080"}'
curl -X POST http://localhost:9070/endpoints -H 'content-type: application/json' -d '{"uri": "http://host.docker.internal:9080"}'
```


Invoke the example service from the command line:
```shell
curl -X POST http://localhost:9090/greeter/greet -H 'content-type: application/json' -d '{"name": "Pete"}'
curl -X POST http://localhost:8080/greeter/greet -H 'content-type: application/json' -d '{"name": "Pete"}'
```

# Releasing the package
Expand Down
2 changes: 1 addition & 1 deletion examples/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ restate
.createServer()
.bindRouter("greeter", greeter)
.bindKeyedRouter("counter", counter)
.listen(8080);
.listen(9080);
2 changes: 1 addition & 1 deletion examples/grpc_example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ restate
service: "TestGreeter",
instance: new GreeterService(),
})
.listen(8080);
.listen(9080);
2 changes: 1 addition & 1 deletion examples/handler_example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ const profile = restate.keyedRouter({
});

// restate server
restate.createServer().bindKeyedRouter("profile", profile).listen(8080);
restate.createServer().bindKeyedRouter("profile", profile).listen(9080);
8 changes: 4 additions & 4 deletions src/restate_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ export function setContext<T>(instance: T, context: RestateGrpcContext): T {
*
* export const myApi: restate.ServiceApi<typeof router> = { path : "myservice" };
*
* restate.createServer().bindRouter("myservice", router).listen(8080);
* restate.createServer().bindRouter("myservice", router).listen(9080);
* ```
* **Client side:**
* ```ts
Expand Down Expand Up @@ -362,7 +362,7 @@ export interface RpcContext extends RestateBaseContext {
* // option 2: export the API definition with type and name (path)
* export const myApi: restate.ServiceApi<typeof router> = { path : "myservice" };
*
* restate.createServer().bindRouter("myservice", router).listen(8080);
* restate.createServer().bindRouter("myservice", router).listen(9080);
* ```
* **Client side:**
* ```ts
Expand Down Expand Up @@ -403,7 +403,7 @@ export interface RpcContext extends RestateBaseContext {
* // option 2: export the API definition with type and name (path)
* export const myApi: restate.ServiceApi<typeof router> = { path : "myservice" };
*
* restate.createServer().bindRouter("myservice", router).listen(8080);
* restate.createServer().bindRouter("myservice", router).listen(9080);
* ```
* **Client side:**
* ```ts
Expand Down Expand Up @@ -450,7 +450,7 @@ export interface RpcContext extends RestateBaseContext {
* // option 2: export the API definition with type and name (path)
* export const myApi: restate.ServiceApi<typeof router> = { path : "myservice" };
*
* restate.createServer().bindRouter("myservice", router).listen(8080);
* restate.createServer().bindRouter("myservice", router).listen(9080);
* ```
* **Client side:**
* ```ts
Expand Down
4 changes: 2 additions & 2 deletions src/server/restate_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,15 @@ export class RestateServer extends BaseRestateServer {
*
* If the port is undefined, this method will use the port set in the `PORT`
* environment variable. If that variable is undefined as well, the method will
* default to port 8080.
* default to port 9080.
*
* This method's result promise never completes.
*
* @param port The port to listen at. May be undefined (see above).
*/
public async listen(port?: number) {
// Infer the port if not specified, or default it
const actualPort = port ?? parseInt(process.env.PORT ?? "8080");
const actualPort = port ?? parseInt(process.env.PORT ?? "9080");
rlog.info(`Listening on ${actualPort}...`);

for await (const connection of incomingConnectionAtPort(actualPort)) {
Expand Down

0 comments on commit 5acc5ec

Please sign in to comment.