Display, update, and delete media
Any visitor to MERN Mediastream will be able to view media details and stream the video, while only registered users will be able to edit the details and delete the media any time after they post it on the application.
Display media
Any visitor to the MERN Mediastream will be able to browse to a single media view to play the video and read the details associated with the media. Every time a specific video is loaded on the application, we will also increment the number of views associated with the media.
Read media API
To fetch media information for a specific media record, we will set up a route that accepts a GET request at '/api/media/:mediaId'
.
mern-mediastream/server/routes/media.routes.js
:
router.route('/api/media/:mediaId') .get( mediaCtrl.incrementViews, mediaCtrl.read)
The mediaId
in the request URL will cause the mediaByID
controller method to execute and attach the retrieved media document to the request object. Then this media data will be returned...