mirror of
https://gitlab.rlp.net/proj-wise2526-video2document/video2document.git
synced 2026-06-15 18:01:52 +02:00
45 lines
1.2 KiB
JavaScript
45 lines
1.2 KiB
JavaScript
const express = require('express');
|
|
|
|
const router = express.Router();
|
|
|
|
//Uploading a video file
|
|
router.post("/", async(req, res) =>{
|
|
try{
|
|
res.status(201).json({video:"VideoID"}); //TODO: return id as json
|
|
}
|
|
catch(e){
|
|
res.status(500).send("Error trying to upload video file.");
|
|
}
|
|
|
|
});
|
|
|
|
//Requesting a list of all video files
|
|
router.get("/", async(req, res) => {
|
|
try {
|
|
res.status(200).json({videos:[]}); //TODO: return a json array showing all video files
|
|
} catch (e) {
|
|
res.status(500).send("Error trying to get the video files.")
|
|
}
|
|
|
|
});
|
|
|
|
//Getting a video file by id
|
|
router.get("/:id", async(req, res) => {
|
|
try {
|
|
res.status(200).json({video: "id"}); //TODO: return the details regarding a specific video
|
|
} catch (e) {
|
|
res.status(401).send("Unknown ID.")
|
|
}
|
|
});
|
|
|
|
//Deleting a video file
|
|
router.delete("/:id", async(req, res) =>{
|
|
try {
|
|
res.status(200).send("Deleted file."); //TODO: delet the video file
|
|
} catch (e) {
|
|
res.status(204).send("No content.");
|
|
}
|
|
});
|
|
|
|
//To make the router useable in the main.js file
|
|
module.exports = router; |