diff --git a/examples/pg/docker-compose.yml b/examples/pg/docker-compose.yml index e7b9435..9b3464f 100644 --- a/examples/pg/docker-compose.yml +++ b/examples/pg/docker-compose.yml @@ -4,7 +4,7 @@ services: postgres: image: postgres ports: - - 5432:5432 + - 5434:5432 environment: - POSTGRES_USER=outbox - POSTGRES_PASSWORD=outbox diff --git a/examples/pg/package.json b/examples/pg/package.json index 350658e..3a08c67 100644 --- a/examples/pg/package.json +++ b/examples/pg/package.json @@ -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", diff --git a/examples/pg/processor.ts b/examples/pg/processor.ts index 762fa35..155c028 100644 --- a/examples/pg/processor.ts +++ b/examples/pg/processor.ts @@ -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(); @@ -15,6 +15,7 @@ let processor: ReturnType | 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); diff --git a/examples/pg/index.ts b/examples/pg/server.ts similarity index 96% rename from examples/pg/index.ts rename to examples/pg/server.ts index 6ea2d72..d273847 100644 --- a/examples/pg/index.ts +++ b/examples/pg/server.ts @@ -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); @@ -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); diff --git a/examples/pg/tsconfig.json b/examples/pg/tsconfig.json index e9e207f..5fe81a6 100644 --- a/examples/pg/tsconfig.json +++ b/examples/pg/tsconfig.json @@ -9,6 +9,6 @@ "outDir": "dist", "declaration": true }, - "include": ["index.ts"], + "include": ["server.ts", "processor.ts"], "exclude": ["dist", "node_modules"] }