https://github.com/sonichigo/mux-sql
A Demo setup on how devpod can be used with Keploy
https://github.com/sonichigo/mux-sql
devcontainer devpod keploy
Last synced: 4 months ago
JSON representation
A Demo setup on how devpod can be used with Keploy
- Host: GitHub
- URL: https://github.com/sonichigo/mux-sql
- Owner: Sonichigo
- Created: 2024-06-11T09:14:15.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-22T05:15:03.000Z (12 months ago)
- Last Synced: 2025-03-25T01:33:57.596Z (11 months ago)
- Topics: devcontainer, devpod, keploy
- Language: Go
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MUX-SQL
This is a sample application that uses the `gorilla/mux` router and `Postgres` for database operations. The application is a simple product catalog that allows you to add products, fetch all products, and fetch a single product.
## Installation Setup
```bash
git clone https://github.com/keploy/samples-go.git && cd samples-go/mux-sql
go mod download
```
Using the docker-compose file we will start our postgres instance:-
```bash
# Start Postgres
docker-compose up -d postgres
```
### Update the Host
> **Since we have setup our sample-app natively set the host to `localhost` on line 10.**
### Capture the Testcases
Now, we will create the binary of our application:-
```zsh
go build -cover
```
### 1. Generate shortned url
```bash
curl --request POST \
--url http://localhost:8010/product \
--header 'content-type: application/json' \
--data '{
"name":"Bubbles",
"price": 123
}'
```
this will return the response.
```
{
"id": 1,
"name": "Bubbles",
"price": 123
}
```
### 2. Fetch the Products
```bash
curl --request GET \
--url http://localhost:8010/products
```
we will get output:
```json
[{"id":1,"name":"Bubbles","price":123},{"id":2,"name":"Bubbles","price":123}]
```
### 3. Fetch a single product
```sh
curl --request GET \
--url http://localhost:8010/product/1
we will get output:-
```json
{"id":1,"name":"Bubbles","price":123}
```