Skip to content

Commit 18a7e31

Browse files
committed
Update README.md
Signed-off-by: Pranav Metil <76805382+Pranav5255@users.noreply.github.com> Signed-off-by: Pranav5255 <pranavmetil@gmail.com>
1 parent 92f61d1 commit 18a7e31

1 file changed

Lines changed: 74 additions & 1 deletion

File tree

crud-app-mongodb/README.md

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,4 +180,77 @@ Always use `sudo -E env "PATH=$PATH"` with Keploy commands to preserve environme
180180

181181
- [Keploy Documentation](https://keploy.io/docs)
182182
- [.NET 8 Documentation](https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-8)
183-
- [MongoDB .NET Driver](https://www.mongodb.com/docs/drivers/csharp/)
183+
- [MongoDB .NET Driver](https://www.mongodb.com/docs/drivers/csharp/)
184+
185+
# CRUD app using MongoDB
186+
187+
This repository contains a sample .NET 7 Web API that uses MongoDB for CRUD operations and integrates with [Keploy](https://keploy.io) to auto-generate and run test cases by recording real API traffic.
188+
189+
---
190+
191+
## 📦 Tech Stack
192+
193+
- [.NET 8 Web API](https://dotnet.microsoft.com/)
194+
- [MongoDB](https://www.mongodb.com/)
195+
- [Keploy](https://keploy.io) – API testing and mocking tool
196+
197+
---
198+
199+
## 🚀 Getting Started
200+
201+
### 1. Clone the Repository
202+
203+
``` bash
204+
git clone https://github.com/Pranav5255/samples-mongodb.git
205+
cd samples-mongodb
206+
```
207+
208+
### 2. Configure MongoDB
209+
Update `appsettings.json` with your MongoDB connection string:
210+
211+
``` json
212+
{
213+
"ConnectionString": "mongodb://localhost:27017",
214+
"DatabaseName": "UserDb",
215+
"UsersCollectionName": "Users"
216+
}
217+
```
218+
### 3. Run the .NET App
219+
``` bash
220+
dotnet run
221+
```
222+
223+
App runs by default at:
224+
``` arduino
225+
http://localhost:5067
226+
```
227+
228+
You can test endpoints like:
229+
``` http
230+
GET /users
231+
POST /users
232+
GET /users/{id}
233+
```
234+
235+
## 🐾 Generate Test Cases with Keploy
236+
### 1. Download Keploy
237+
``` powershell
238+
curl -O -L https://keploy.io/install.sh && source install.sh
239+
```
240+
241+
### 2. Record API Calls
242+
``` bash
243+
keploy.exe record --proxy-port 8080 --app-port 5067 --path ./keploy-tests
244+
```
245+
246+
Now send traffic to:
247+
``` bash
248+
http://localhost:8080/users
249+
```
250+
Use Postman, Swagger or cURL to generate traffic.
251+
252+
### 3. Replay Tests
253+
After Recording:
254+
``` bash
255+
keploy.exe test --path ./keploy-tests
256+
```

0 commit comments

Comments
 (0)