Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 126 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,132 @@ Arquivo: `get-users-(id)-get.json`
}
```

### 2. POST com Body e Headers

Arquivo: `post-users.json`

```json
{
"request": {
"body": {
"name": "Jane Doe",
"email": "jane.doe@example.com",
"age": 30
},
"headers": {
"Authorization": "Bearer abc123"
}
},
"response": {
"status": 201,
"body": {
"message": "User created successfully",
"userId": "456"
}
}
}
```

### 3. PUT com Body e Params

Arquivo: `put-users-(id).json`

```json
{
"request": {
"params": {
"id": "456"
},
"body": {
"name": "Jane Doe Updated",
"age": 31
}
},
"response": {
"status": 200,
"body": {
"message": "User updated successfully"
}
}
}
```

### 3. DELETE com params

Arquivo: `delete-users-(id).json`

```json
{
"request": {
"params": {
"id": "456"
}
},
"response": {
"status": 204
}
}
```

### 4. POST com body e schema registry

Arquivo: `post-products.json`

```json
{
"request": {
"body": {
"name": "Tablet",
"price": 299.99
},
"schema": {
"type": "object",
"properties": {
"name": { "type": "string" },
"price": { "type": "number" }
},
"required": ["name", "price"]
}
},
"response": {
"status": 201,
"body": {
"message": "Product created successfully",
"productId": "789"
}
}
}
```

### 5. GET com Params e Query

Arquivo: `get-products.json`

```json
{
"request": {
"query": {
"category": "electronics"
}
},
"response": {
"status": 200,
"body": [
{
"id": 1,
"name": "Smartphone",
"price": 599.99
},
{
"id": 2,
"name": "Laptop",
"price": 1299.99
}
]
}
}
```

## Como Contribuir

Contribuições são bem-vindas! Por favor, leia as diretrizes detalhadas no arquivo [CONTRIBUTING.md](https://github.com/robinhosz/mock-api-server/blob/master/CONTRIBUTING.md).
Expand Down
2 changes: 1 addition & 1 deletion mocks/develop/get-users-(id).json
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
"email": "john.doe@example.com"
}
}
}
}
2 changes: 1 addition & 1 deletion mocks/develop/post-users.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
"message": "User created successfully"
}
}
}
}
2 changes: 1 addition & 1 deletion mocks/main/delete-products-(id).json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"response": {
"status": 204
}
}
}
2 changes: 1 addition & 1 deletion mocks/main/delete-users-(id).json
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"response": {
"status": 204
}
}
}
2 changes: 1 addition & 1 deletion mocks/main/get-products.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
}
]
}
}
}
2 changes: 1 addition & 1 deletion mocks/main/post-products.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
"productId": "789"
}
}
}
}
2 changes: 1 addition & 1 deletion mocks/main/post-users.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
"userId": "456"
}
}
}
}
2 changes: 1 addition & 1 deletion mocks/main/put-products-(id).json
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
"message": "Product updated successfully"
}
}
}
}
2 changes: 1 addition & 1 deletion mocks/main/put-users-(id).json
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
"message": "User updated successfully"
}
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "virtualizacao-services",
"version": "1.0.5",
"version": "1.0.1",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
Expand Down