Skip to content

Commit 447514c

Browse files
authored
Added GET methods
1 parent 7f3679e commit 447514c

File tree

1 file changed

+112
-112
lines changed

1 file changed

+112
-112
lines changed

README.md

+112-112
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,112 @@
1-
2-
# KarlJoke
3-
4-
A free and open-source restful API to fetch dadjokes
5-
6-
Inspired from https://github.com/15Dkatz/official_joke_api
7-
8-
Since the creators are not accepting PRs' and also the server is unavailable, we have a new system in place as an alternative 🚀
9-
10-
11-
## Public Endpoints
12-
13-
#### Get a random joke
14-
15-
```http
16-
POST /jokes/random
17-
```
18-
#### Get ten random jokes
19-
20-
```http
21-
POST /jokes/ten
22-
```
23-
#### Get number of random jokes
24-
25-
```http
26-
POST /jokes/{number}
27-
```
28-
29-
| Parameter | Type | Description |
30-
| :-------- | :------- | :-------------------------------- |
31-
| `number` | `int` | **Required**. Number of jokes to fetch |
32-
33-
#### Get random joke by type
34-
```http
35-
POST /jokes/{type}/random
36-
```
37-
| Parameter | Type | Description |
38-
| :-------- | :------- | :-------------------------------- |
39-
| `type` | `string` | **Required**. Category of joke |
40-
41-
#### Get number of random jokes by type
42-
```http
43-
POST /jokes/{type}/{number}
44-
```
45-
| Parameter | Type | Description |
46-
| :-------- | :------- | :-------------------------------- |
47-
| `type` | `string` | **Required**. Category of joke |
48-
| `number` | `int` | **Required**. Number of jokes to fetch |
49-
50-
#### Get joke by type and id
51-
```http
52-
POST /jokes/{type}/{id}
53-
```
54-
| Parameter | Type | Description |
55-
| :-------- | :------- | :-------------------------------- |
56-
| `type` | `string` | **Required**. Category of joke |
57-
| `id` | `int` | **Required**. ID of joke |
58-
59-
60-
61-
62-
63-
## Authors
64-
65-
- [Eklavya Chandra](https://www.github.com/eklavyadev)
66-
67-
68-
## Contributing
69-
70-
Contributions are always welcome!
71-
72-
### Implement jokes.json with this structure
73-
```
74-
},
75-
{
76-
"id": last joke id + 1,
77-
"type": "Your category here",
78-
"setup": "Your joke here",
79-
"punchline": "Your punchline here"
80-
}
81-
```
82-
83-
Please adhere to this project's `code of conduct`.
84-
85-
86-
## Run Locally
87-
88-
Clone the project
89-
90-
```bash
91-
git clone https://github.com/eklavyadev/karljoke.git
92-
```
93-
94-
Go to the project directory
95-
96-
```bash
97-
cd karljoke
98-
```
99-
100-
Install dependencies
101-
102-
```bash
103-
npm install
104-
```
105-
106-
Start the server
107-
108-
```bash
109-
npm run start
110-
```
111-
112-
1+
2+
# KarlJoke
3+
4+
A free and open-source restful API to fetch dadjokes
5+
6+
Inspired from https://github.com/15Dkatz/official_joke_api
7+
8+
Since the creators are not accepting PRs' and also the server is unavailable, we have a new system in place as an alternative 🚀
9+
10+
11+
## Public Endpoints
12+
13+
#### Get a random joke
14+
15+
```http
16+
GET /jokes/random
17+
```
18+
#### Get ten random jokes
19+
20+
```http
21+
GET /jokes/ten
22+
```
23+
#### Get number of random jokes
24+
25+
```http
26+
GET /jokes/{number}
27+
```
28+
29+
| Parameter | Type | Description |
30+
| :-------- | :------- | :-------------------------------- |
31+
| `number` | `int` | **Required**. Number of jokes to fetch |
32+
33+
#### Get random joke by type
34+
```http
35+
GET /jokes/{type}/random
36+
```
37+
| Parameter | Type | Description |
38+
| :-------- | :------- | :-------------------------------- |
39+
| `type` | `string` | **Required**. Category of joke |
40+
41+
#### Get number of random jokes by type
42+
```http
43+
GET /jokes/{type}/{number}
44+
```
45+
| Parameter | Type | Description |
46+
| :-------- | :------- | :-------------------------------- |
47+
| `type` | `string` | **Required**. Category of joke |
48+
| `number` | `int` | **Required**. Number of jokes to fetch |
49+
50+
#### Get joke by type and id
51+
```http
52+
GET /jokes/{type}/{id}
53+
```
54+
| Parameter | Type | Description |
55+
| :-------- | :------- | :-------------------------------- |
56+
| `type` | `string` | **Required**. Category of joke |
57+
| `id` | `int` | **Required**. ID of joke |
58+
59+
60+
61+
62+
63+
## Authors
64+
65+
- [Eklavya Chandra](https://www.github.com/eklavyadev)
66+
67+
68+
## Contributing
69+
70+
Contributions are always welcome!
71+
72+
### Implement jokes.json with this structure
73+
```
74+
},
75+
{
76+
"id": last joke id + 1,
77+
"type": "Your category here",
78+
"setup": "Your joke here",
79+
"punchline": "Your punchline here"
80+
}
81+
```
82+
83+
Please adhere to this project's `code of conduct`.
84+
85+
86+
## Run Locally
87+
88+
Clone the project
89+
90+
```bash
91+
git clone https://github.com/eklavyadev/karljoke.git
92+
```
93+
94+
Go to the project directory
95+
96+
```bash
97+
cd karljoke
98+
```
99+
100+
Install dependencies
101+
102+
```bash
103+
npm install
104+
```
105+
106+
Start the server
107+
108+
```bash
109+
npm run start
110+
```
111+
112+

0 commit comments

Comments
 (0)