Any visitor browsing through the MERN Mediastream application will be able to view the media posted on the application by its users. Implementing this feature will require streaming the video files stored in MongoDB GridFS to the requesting client and rendering the stream in a media player. In the following sections, we will set up a backend API to retrieve a single video file, which we will then use as a source in a React-based media player to render the streaming video.
Retrieving and streaming media
The video API
To retrieve the video file associated with a single media post, we will implement a get video API that will accept a GET request at '/api/medias/video/:mediaId' and query both the Media collection and...