Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonstreator committed May 29, 2024
1 parent 7583848 commit 3216e1c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/pg/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
postgres:
image: postgres
ports:
- 5432:5432
- 5434:5432
environment:
- POSTGRES_USER=outbox
- POSTGRES_PASSWORD=outbox
Expand Down
3 changes: 2 additions & 1 deletion examples/pg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"main": "index.js",
"license": "MIT",
"scripts": {
"dev": "nodemon index.ts"
"dev:server": "nodemon server.ts",
"dev:processor": "nodemon processor.ts"
},
"dependencies": {
"http-graceful-shutdown": "^3.1.13",
Expand Down
3 changes: 2 additions & 1 deletion examples/pg/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
EventProcessor,
} from "../../src/processor";
import { createProcessorClient } from "../../src/pg/client";
import { migrate, type EventType } from "./index";
import { migrate, type EventType } from "./server";
import dotenv from "dotenv";
dotenv.config();

Expand All @@ -15,6 +15,7 @@ let processor: ReturnType<typeof EventProcessor> | undefined = undefined;
user: process.env.POSTGRES_USER,
password: process.env.POSTGRES_PASSWORD,
database: process.env.POSTGRES_DB,
port: parseInt(process.env.POSTGRES_PORT || "5434"),
});
await client.connect();
await migrate(client);
Expand Down
3 changes: 2 additions & 1 deletion examples/pg/index.ts → examples/pg/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const main = async () => {
user: process.env.POSTGRES_USER,
password: process.env.POSTGRES_PASSWORD,
database: process.env.POSTGRES_DB,
port: parseInt(process.env.POSTGRES_PORT || "5434"),
});
await client.connect();
await migrate(client);
Expand Down Expand Up @@ -64,7 +65,7 @@ const main = async () => {
}
res.end();
});
const port = process.env.PORT || 3000;
const port = process.env.PORT || 3003;
server.listen(port, () => console.log(`listening on ${port}`));

gracefulShutdown(server);
Expand Down
2 changes: 1 addition & 1 deletion examples/pg/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"outDir": "dist",
"declaration": true
},
"include": ["index.ts"],
"include": ["server.ts", "processor.ts"],
"exclude": ["dist", "node_modules"]
}

0 comments on commit 3216e1c

Please sign in to comment.