From 8411d17e0adf8f5ebe9f0e91ec71a5a926b9955f Mon Sep 17 00:00:00 2001 From: robinhosz Date: Sun, 23 Mar 2025 17:29:28 -0300 Subject: [PATCH] docs: atualizando README.md --- README.md | 126 +++++++++++++++++++++++++++ mocks/develop/get-users-(id).json | 2 +- mocks/develop/post-users.json | 2 +- mocks/main/delete-products-(id).json | 2 +- mocks/main/delete-users-(id).json | 2 +- mocks/main/get-products.json | 2 +- mocks/main/post-products.json | 2 +- mocks/main/post-users.json | 2 +- mocks/main/put-products-(id).json | 2 +- mocks/main/put-users-(id).json | 2 +- package.json | 2 +- 11 files changed, 136 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 2fdfe72..eda4a39 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/mocks/develop/get-users-(id).json b/mocks/develop/get-users-(id).json index 9e1f6ca..8836ac3 100644 --- a/mocks/develop/get-users-(id).json +++ b/mocks/develop/get-users-(id).json @@ -12,4 +12,4 @@ "email": "john.doe@example.com" } } - } \ No newline at end of file +} \ No newline at end of file diff --git a/mocks/develop/post-users.json b/mocks/develop/post-users.json index 43d33e2..f9e8a6a 100644 --- a/mocks/develop/post-users.json +++ b/mocks/develop/post-users.json @@ -19,4 +19,4 @@ "message": "User created successfully" } } - } \ No newline at end of file +} \ No newline at end of file diff --git a/mocks/main/delete-products-(id).json b/mocks/main/delete-products-(id).json index 84c84db..b8a73ec 100644 --- a/mocks/main/delete-products-(id).json +++ b/mocks/main/delete-products-(id).json @@ -10,4 +10,4 @@ "response": { "status": 204 } - } \ No newline at end of file +} \ No newline at end of file diff --git a/mocks/main/delete-users-(id).json b/mocks/main/delete-users-(id).json index b4dbaad..ef89ae9 100644 --- a/mocks/main/delete-users-(id).json +++ b/mocks/main/delete-users-(id).json @@ -7,4 +7,4 @@ "response": { "status": 204 } - } \ No newline at end of file +} \ No newline at end of file diff --git a/mocks/main/get-products.json b/mocks/main/get-products.json index 93a7d2c..611c264 100644 --- a/mocks/main/get-products.json +++ b/mocks/main/get-products.json @@ -19,4 +19,4 @@ } ] } - } \ No newline at end of file +} \ No newline at end of file diff --git a/mocks/main/post-products.json b/mocks/main/post-products.json index fca2fb3..588faf6 100644 --- a/mocks/main/post-products.json +++ b/mocks/main/post-products.json @@ -20,4 +20,4 @@ "productId": "789" } } - } \ No newline at end of file +} \ No newline at end of file diff --git a/mocks/main/post-users.json b/mocks/main/post-users.json index 3f83cae..7670d48 100644 --- a/mocks/main/post-users.json +++ b/mocks/main/post-users.json @@ -16,4 +16,4 @@ "userId": "456" } } - } \ No newline at end of file +} \ No newline at end of file diff --git a/mocks/main/put-products-(id).json b/mocks/main/put-products-(id).json index 3b731db..6dc18e5 100644 --- a/mocks/main/put-products-(id).json +++ b/mocks/main/put-products-(id).json @@ -17,4 +17,4 @@ "message": "Product updated successfully" } } - } \ No newline at end of file +} \ No newline at end of file diff --git a/mocks/main/put-users-(id).json b/mocks/main/put-users-(id).json index 1a02f31..508d7ea 100644 --- a/mocks/main/put-users-(id).json +++ b/mocks/main/put-users-(id).json @@ -14,4 +14,4 @@ "message": "User updated successfully" } } - } \ No newline at end of file +} \ No newline at end of file diff --git a/package.json b/package.json index 7f5ddbe..5b3af0f 100644 --- a/package.json +++ b/package.json @@ -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",