Skip to content

Commit 7e099c8

Browse files
Abbhiishekactions-user
authored andcommitted
docs: update docs for docker support in express-postgresql-prisma app (#468)
1 parent eb9de8a commit 7e099c8

File tree

1 file changed

+34
-7
lines changed

1 file changed

+34
-7
lines changed

versioned_docs/version-2.0.0/quickstart/express-postgresql-prisma.md

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,34 +43,36 @@ git clone https://github.com/keploy/samples-typescript.git
4343
cd samples-typescript/express-postgresql-prisma
4444
```
4545

46-
### Install the dependencies
46+
### Running App Locally on Linux/WSL
47+
48+
#### Install the dependencies
4749

4850
```bash
4951
npm install
5052
```
5153

52-
### Set up environment variables:
54+
#### Set up environment variables:
5355

5456
```bash
5557
cp .env.example .env
5658
```
5759

58-
### Start PostgreSQL Container
60+
#### Start PostgreSQL Container
5961

6062
```bash
6163
docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 -d postgres
6264
```
6365

6466
> Note: PostgreSQL Password is `mysecretpassword`
6567
66-
### Update the `.env` file with your PostgreSQL connection string:
68+
#### Update the `.env` file with your PostgreSQL connection string:
6769

6870
```bash
6971
PORT=3000
7072
DATABASE_URL="postgresql://postgres:mysecretpassword@localhost:5432/postgres"
7173
```
7274

73-
### Migrate the database:
75+
#### Migrate the database:
7476

7577
```bash
7678
npm run generate
@@ -112,7 +114,7 @@ nt in 50ms
112114
└─────────────────────────────────────────────────────────┘
113115
```
114116

115-
### Start the application:
117+
#### Start the application:
116118

117119
```bash
118120
npm run dev
@@ -129,7 +131,7 @@ Server is listening at PORT 3000
129131
130132
Now we walkthrough how to leverage Keploy to automatically generate test cases for the application, and later test the application using Keploy.
131133

132-
### Generate Test Cases
134+
#### Generate Test Cases
133135

134136
> Note: Build the application first using `npm run build`
135137
@@ -173,6 +175,21 @@ The above command will start recording the API calls made to the application and
173175
174176
> 💡 You can use Postman or any other API testing tool to test the API calls. Additionally, the application will run a swagger UI on `http://localhost:3000/api/docs` to visualize the API calls.
175177
178+
### Running App using Docker Compose 🐳
179+
180+
We will be using Docker compose to run the application as well as PostreSql on Docker container.
181+
182+
Lights, Camera, Record! 🎥
183+
Fire up the application and mongoDB instance with Keploy. Keep an eye on the two key flags: -c: Command to run the app (e.g., docker compose up).
184+
185+
--container-name: The container name in the docker-compose.yml for traffic interception.
186+
187+
```bash
188+
keploy record -c "docker compose up" --container-name "express-postgresql-prisma-app" --build-delay 50
189+
```
190+
191+
**🔥 Challenge time!** Generate some test cases. How? Just make some API calls. Postman, Hoppscotch or even curl - take your pick!
192+
176193
### Interact with Application
177194
178195
Make API Calls using [Hoppscotch](https://hoppscotch.io/), [Postman](https://www.postman.com/) or [cURL](https://curl.se/) command. Keploy with capture those calls to generate the test-suites containing testcases and data mocks.
@@ -317,10 +334,20 @@ curl -X 'DELETE' \
317334
318335
### Test the Application using Keploy
319336
337+
#### on Linux/WSL
338+
320339
```bash
321340
keploy test -c "npm start"
322341
```
323342
343+
#### On Docker Compose 🐳
344+
345+
```bash
346+
keploy test -c "docker compose up" --container-name "nodeMongoApp" --build-delay 50 --delay 10
347+
```
348+
349+
> The **--delay** flag? Oh, that's just giving your app a little breather (in seconds) before the test cases come knocking.
350+
324351
Keploy will replay the recorded interactions and validate the responses against the expected results.
325352
326353
```bash

0 commit comments

Comments
 (0)