diff options
author | Matt Strapp <matt@mattstrapp.net> | 2022-03-24 10:10:58 -0500 |
---|---|---|
committer | Matt Strapp <matt@mattstrapp.net> | 2022-03-24 10:10:58 -0500 |
commit | 9ebb969d03acdc5bb0f80cc1311d73719688542d (patch) | |
tree | 83635f17dabdeb0e8629140cb366f00a49c8c3b7 /src/routes | |
parent | Bump minimist from 1.2.5 to 1.2.6 (#32) (diff) | |
download | ee4511w-web-9ebb969d03acdc5bb0f80cc1311d73719688542d.tar ee4511w-web-9ebb969d03acdc5bb0f80cc1311d73719688542d.tar.gz ee4511w-web-9ebb969d03acdc5bb0f80cc1311d73719688542d.tar.bz2 ee4511w-web-9ebb969d03acdc5bb0f80cc1311d73719688542d.tar.lz ee4511w-web-9ebb969d03acdc5bb0f80cc1311d73719688542d.tar.xz ee4511w-web-9ebb969d03acdc5bb0f80cc1311d73719688542d.tar.zst ee4511w-web-9ebb969d03acdc5bb0f80cc1311d73719688542d.zip |
Add camera support
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
Diffstat (limited to 'src/routes')
-rw-r--r-- | src/routes/pendulum.ts (renamed from src/routes/api.ts) | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/routes/api.ts b/src/routes/pendulum.ts index 22edd79..66ad594 100644 --- a/src/routes/api.ts +++ b/src/routes/pendulum.ts @@ -6,6 +6,9 @@ import fileUpload, { UploadedFile } from 'express-fileupload'; import { access, stat } from 'fs/promises'; import { quote } from 'shell-quote'; +/** + * The endpoint for the API calls involving file uploads and running the files on the pendulum. + */ const api = express.Router(); // Use JSON parser for API requests and responses @@ -217,16 +220,14 @@ api return res.status(405).json({ error: 'Method not allowed.' }); }); -/* - Verify that the file exists and is a regular file - Parameters: - path: The path to the file on the server - res: The response object to send the unsuccessful response to - Returns: - true: The file exists and is a regular file - false: The file does not exist or is not a regular file - ** AFTER THIS POINT, THE API HAS ALREADY SENT A RESPONSE, SO THE FUNCTION THAT CALLED IT SHOULD NOT RETURN ANOTHER RESPONSE ** -*/ +/** + * Verify that the file exists and is a regular file so it can be sent to the user + * @param file The path to the file + * @param res The Express response object, used if the file is not accessible + * @returns `true` if the file exists and is a regular file,`false` otherwise + * + * `AFTER THIS POINT, THE API HAS ALREADY SENT A RESPONSE, SO THE FUNCTION THAT CALLED IT SHOULD NOT RETURN ANOTHER RESPONSE ` + */ async function verifyFile(file: string, res: Response) { // Make sure the file being requested to run exists try { |