-
Notifications
You must be signed in to change notification settings - Fork 28
/
index.html
147 lines (147 loc) · 6.08 KB
/
index.html
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<html><head><style>body {
color: black;
}
</style></head><body><h1 id="file-manager-open-to-edit-">File Manager(open to edit)</h1>
<p>A dockerized micro-service for adding, updating, retrieving and deleting files</p>
<h3 id="quick-start">Quick Start</h3>
<h3 id="testing">Testing</h3>
<h3 id="files">Files</h3>
<h4 id="create-a-file">Create a File</h4>
<ul>
<li><p>Method - POST</p>
</li>
<li><p>URL - <a href="http://localhost:3000/api/v1/files/">http://localhost:3000/api/v1/files/</a></p>
</li>
<li><p>Sample Request</p>
</li>
</ul>
<pre><code>{
<span class="hljs-attr">"file"</span>: <span class="hljs-string">"mark.png"</span>
}
</code></pre><ul>
<li>Sample Response</li>
</ul>
<pre><code>{
<span class="hljs-attr">"status"</span>: <span class="hljs-literal">true</span>,
<span class="hljs-attr">"message"</span>: <span class="hljs-string">"File Uploaded"</span>,
<span class="hljs-attr">"data"</span>: <span class="hljs-literal">null</span>
}
</code></pre><h4 id="get-all-files">Get all Files</h4>
<ul>
<li><p>Method - GET</p>
</li>
<li><p>URL - <a href="http://localhost:3000/api/v1/files/">http://localhost:3000/api/v1/files/</a></p>
</li>
<li><p>Sample Response</p>
</li>
</ul>
<pre><code>{
<span class="hljs-attr">"status"</span>: <span class="hljs-literal">true</span>,
<span class="hljs-attr">"message"</span>: <span class="hljs-string">"Files Found"</span>,
<span class="hljs-attr">"data"</span>: [
{
<span class="hljs-attr">"id"</span>: <span class="hljs-string">"5e6288bc8c7fec6308a1d499"</span>,
<span class="hljs-attr">"file"</span>: <span class="hljs-string">"s3://falcon-bucket/files/mark.png"</span>
},
{
<span class="hljs-attr">"id"</span>: <span class="hljs-string">"5e6288bc8c7fec6308a1d498"</span>,
<span class="hljs-attr">"file"</span>: <span class="hljs-string">"s3://falcon-bucket/files/essien.gif"</span>
},
{
<span class="hljs-attr">"id"</span>: <span class="hljs-string">"5e6288bc8c7fec6308a1d497"</span>,
<span class="hljs-attr">"file"</span>: <span class="hljs-string">"s3://falcon-bucket/files/seyi.jpg"</span>
},
{
<span class="hljs-attr">"id"</span>: <span class="hljs-string">"5e6288bc8c7fec6308a1d496"</span>,
<span class="hljs-attr">"file"</span>: <span class="hljs-string">"s3://falcon-bucket/files/john.gif"</span>
},
{
<span class="hljs-attr">"id"</span>: <span class="hljs-string">"5e6288bc8c7fec6308a1d495"</span>,
<span class="hljs-attr">"file"</span>: <span class="hljs-string">"s3://falcon-bucket/files/doe.jpeg"</span>
}
]
}
</code></pre><h4 id="get-a-file">Get a File</h4>
<ul>
<li><p>Method - GET</p>
</li>
<li><p>URL - <a href="http://localhost:3000/api/v1/files/:fileId">http://localhost:3000/api/v1/files/:fileId</a></p>
</li>
<li><p>Sample Response</p>
</li>
</ul>
<pre><code>{
<span class="hljs-attr">"status"</span>: <span class="hljs-literal">true</span>,
<span class="hljs-attr">"message"</span>: <span class="hljs-string">"File Found"</span>,
<span class="hljs-attr">"data"</span>: {
<span class="hljs-attr">"id"</span>: <span class="hljs-string">"5e6288bc8c7fec6308a1d499"</span>,
<span class="hljs-attr">"file"</span>: <span class="hljs-string">"s3://falcon-bucket/files/mark.png"</span>
}
}
</code></pre><h4 id="update-a-file">Update a File</h4>
<ul>
<li><p>Method - PUT</p>
</li>
<li><p>URL - <a href="http://localhost:3000/api/v1/files/:fileId">http://localhost:3000/api/v1/files/:fileId</a></p>
</li>
<li><p>HEADER</p>
</li>
<li><p>Sample Request</p>
</li>
</ul>
<pre><code>{
<span class="hljs-attr">"id"</span>: <span class="hljs-string">"5e6288bc8c7fec6308a1d499"</span>,
<span class="hljs-attr">"file"</span>: <span class="hljs-string">"s3://falcon-bucket/files/mark.png"</span>
}
</code></pre><ul>
<li>Sample Response</li>
</ul>
<pre><code>{
<span class="hljs-attr">"status"</span>: <span class="hljs-literal">true</span>,
<span class="hljs-attr">"message"</span>: <span class="hljs-string">"File Updated"</span>,
<span class="hljs-attr">"data"</span>: <span class="hljs-literal">null</span>
}
</code></pre><h4 id="delete-a-file">Delete a File</h4>
<ul>
<li><p>Method - DELETE</p>
</li>
<li><p>URL - <a href="http://localhost:3000/api/v1/files/:fileId">http://localhost:3000/api/v1/files/:fileId</a></p>
</li>
<li><p>HEADER</p>
</li>
<li><p>Sample Request</p>
</li>
</ul>
<pre><code>{
<span class="hljs-attr">"id"</span>: <span class="hljs-string">"5e6288bc8c7fec6308a1d499"</span>
}
</code></pre><ul>
<li>Sample Response</li>
</ul>
<pre><code>{
<span class="hljs-attr">"status"</span>: <span class="hljs-literal">true</span>,
<span class="hljs-attr">"message"</span>: <span class="hljs-string">"File Deleted"</span>,
<span class="hljs-attr">"data"</span>: <span class="hljs-literal">null</span>
}
</code></pre><h4 id="search-a-file">Search a File</h4>
<h4 id="get-all-files-paging">Get all Files - Paging</h4>
<h4 id="file-structure">File structure</h4>
<pre><code>+<span class="hljs-comment">--- config/</span>
+<span class="hljs-comment">--------- config.env - Env variables</span>
+<span class="hljs-comment">--------- db.js - DB config</span>
+<span class="hljs-comment">--- controllers/</span>
+<span class="hljs-comment">--------- files.js - file controllers</span>
+<span class="hljs-comment">--- middleware/</span>
+<span class="hljs-comment">--------- error.js - handles errorHandler().</span>
+<span class="hljs-comment">--- models/ - main folder of the API.</span>
+<span class="hljs-comment">--------- File.js - FileSchema.</span>
+<span class="hljs-comment">--- node_modules/</span>
+<span class="hljs-comment">--- routes/</span>
+<span class="hljs-comment">--------- file.js - router.</span>
+<span class="hljs-comment">--- utils/</span>
+<span class="hljs-comment">--------- errorResponse.js - ErrorResponse class.</span>
+<span class="hljs-comment">--- .gitignore</span>
+<span class="hljs-comment">--- LICENSE</span>
+<span class="hljs-comment">--- index.js</span>
+<span class="hljs-comment">--- README.md</span>
</code></pre></body></html>