I am following along with the book, but am writing my own code. When I reached the part of setting the path to the video asset, I received the error: Error: ENOENT: no such file or directory, despite seemingly having the file path setup correctly. After looking up the error, it seems like an easier way to reach the file path correctly would be to load the path module and use the __dirname variable to join to the relative path.
The final result would look something like this:
const path = require("path");
...
app.get("/video", async (req, res) => {
const videoPath = path.resolve(__dirname, "../videos/SampleVideo.mp4");
...
I am following along with the book, but am writing my own code. When I reached the part of setting the path to the video asset, I received the error:
Error: ENOENT: no such file or directory, despite seemingly having the file path setup correctly. After looking up the error, it seems like an easier way to reach the file path correctly would be to load the path module and use the__dirnamevariable to join to the relative path.The final result would look something like this: