doc update
This commit is contained in:
81
doc/api.md
81
doc/api.md
@@ -4,7 +4,13 @@
|
||||
## Base URL
|
||||
|
||||
```
|
||||
http://localhost:3000
|
||||
http://localhost:3000/api
|
||||
```
|
||||
|
||||
**Default Headers:**
|
||||
|
||||
```
|
||||
Content-Type: application/json
|
||||
```
|
||||
|
||||
---
|
||||
@@ -21,11 +27,6 @@ Sorts an array (numeric or alphabetical) and returns the sorted array.
|
||||
POST /sort
|
||||
```
|
||||
|
||||
**Headers:**
|
||||
|
||||
```
|
||||
Content-Type: application/json
|
||||
```
|
||||
|
||||
**Body Example:**
|
||||
|
||||
@@ -43,16 +44,8 @@ Content-Type: application/json
|
||||
}
|
||||
```
|
||||
|
||||
### Error Responses
|
||||
|
||||
| Status Code | Description |
|
||||
| ----------- | ----------------------------------------------- |
|
||||
| `400` | Request body missing or `array` is not an array |
|
||||
| `500` | Unexpected server error |
|
||||
|
||||
---
|
||||
|
||||
## 2️⃣ POST `/is-odd`
|
||||
## 2️⃣ POST `/isOdd`
|
||||
|
||||
Checks if a given number is odd.
|
||||
|
||||
@@ -61,13 +54,7 @@ Checks if a given number is odd.
|
||||
**URL:**
|
||||
|
||||
```
|
||||
POST /is-odd
|
||||
```
|
||||
|
||||
**Headers:**
|
||||
|
||||
```
|
||||
Content-Type: application/json
|
||||
POST /isOdd
|
||||
```
|
||||
|
||||
**Body Example:**
|
||||
@@ -82,30 +69,13 @@ Content-Type: application/json
|
||||
|
||||
```json
|
||||
{
|
||||
"number": 7,
|
||||
"isOdd": true
|
||||
"ret": true
|
||||
}
|
||||
```
|
||||
|
||||
**Example with an even number:**
|
||||
|
||||
```json
|
||||
{
|
||||
"number": 4,
|
||||
"isOdd": false
|
||||
}
|
||||
```
|
||||
|
||||
### Error Responses
|
||||
|
||||
| Status Code | Description |
|
||||
| ----------- | ------------------------------------------------------ |
|
||||
| `400` | Request body missing or `number` is not a valid number |
|
||||
| `500` | Unexpected server error |
|
||||
|
||||
---
|
||||
|
||||
## 3️⃣ POST `/is-even`
|
||||
## 3️⃣ POST `/isEven`
|
||||
|
||||
Checks if a given number is even.
|
||||
|
||||
@@ -114,13 +84,7 @@ Checks if a given number is even.
|
||||
**URL:**
|
||||
|
||||
```
|
||||
POST /is-even
|
||||
```
|
||||
|
||||
**Headers:**
|
||||
|
||||
```
|
||||
Content-Type: application/json
|
||||
POST /isEven
|
||||
```
|
||||
|
||||
**Body Example:**
|
||||
@@ -135,29 +99,10 @@ Content-Type: application/json
|
||||
|
||||
```json
|
||||
{
|
||||
"number": 4,
|
||||
"isEven": true
|
||||
"ret": true
|
||||
}
|
||||
```
|
||||
|
||||
**Example with an odd number:**
|
||||
|
||||
```json
|
||||
{
|
||||
"number": 7,
|
||||
"isEven": false
|
||||
}
|
||||
```
|
||||
|
||||
### Error Responses
|
||||
|
||||
| Status Code | Description |
|
||||
| ----------- | ------------------------------------------------------ |
|
||||
| `400` | Request body missing or `number` is not a valid number |
|
||||
| `500` | Unexpected server error |
|
||||
|
||||
---
|
||||
|
||||
## 📌 Example Usage with `curl`
|
||||
|
||||
### Sort an array (Linux/macOS)
|
||||
|
||||
Reference in New Issue
Block a user