-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocs.js
79 lines (79 loc) · 1.79 KB
/
docs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
module.exports.documentation = {
message: "Welcome to my app api!",
documentationUrl: "", //leave this also blank for the first exercise
baseUrl: "", //leave this blank for the first exercise
endpoints: [
{
method: "GET",
path: "/api",
description: "Describes all available endpoints",
},
{ method: "GET", path: "/api/profile", description: "Data about me" },
{
method: "GET",
path: "/api/books/",
description: "Get All books information",
},
{
method: "POST",
path: "/api/books/",
description: "Create a new book",
body: {
title: "String",
author: "String",
releaseDate: "String",
genre: "String",
rating: "String",
language: "String",
},
statusCodes: [
{
code: 201,
description: "DB entry has been created",
},
{
code: 400,
description: "Invalid request body",
},
],
},
{
method: "PUT",
path: "/api/books/:id",
description: "Update an existing book",
body: {
title: "String",
author: "String",
releaseDate: "String",
genre: "String",
rating: "String",
language: "String",
},
statusCodes: [
{
code: 200,
description: "Book has been updated",
},
{
code: 400,
description: "Invalid request body",
},
],
},
{
method: "DELETE",
path: "/api/books/:id",
description: "Delete an existing book",
statusCodes: [
{
code: 200,
description: "Book has been deleted",
},
{
code: 404,
description: "Book doesn't exist",
},
],
},
],
};