You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ For example `http://localhost:4000/work?limit=1000` will compute the first 1000
16
16
17
17
-**`/upload`**: Recieves the file in the POST request form field. Creates a temporary file with a unique name in the `./uploads` directory using `os.CreateTemp` and copies the file to it using `io.Copy()`. Renames the temp file using os.Rename() with a safe name created by a helper method in the format `./uploads/uuid_originalFileName.extension`. `uuid` is a unique ID generated by `google/uuid` to maintain unique file names. Performs clean up when the function returns.
18
18
19
-
-**`/download`**: Recieves the file name from the incoming request's `file` query. Checks if the file exists, using `os.Stat()`. If the file exists, it uses `http.ServeFile()` to send the file the client.
19
+
-**`/download`**: Recieves the file name from the incoming request's `file` query. Checks if the file exists, using `os.Stat()`. If the file exists, it uses `http.ServeFile()` to send the file to the client.
20
20
21
21
### Middlewares:
22
22
-**`AuthMiddleware()`**: protects the endpoints and returns 401 if the Basic Auth credentials are invalid. The password has been hardcoded because this is just a practice/learning project and I wanted to focus on other important concepts such as file uploading and downloading.
0 commit comments