title: what is the most elegant way to restrict users from accessing other users' content?
body: <p>I have to build a project where users will login and upload some images and videos, and it should be such that the files uploaded should only be visible by the uploader or the site admin.</p>
  
  <p>I main Node.js, so i tried using express middle wares to restrict the media files by user, but it came to my notice that this isn't the best way to handle this as express isn't good at rendering static content.</p>
  
  <p>Here are some options i can think of after some google sessions</p>
  
  <ul>
  <li>Amazon S3 bucket where each user gets  their own folder/permissions and files no into this (but are the files truly private when we have a url)</li>
  <li>Generate a temporary URL of the files using pre-signed URLs from S3 bucket ( the file will be public for 20 min, i don't want this)</li>
  <li>Restrict access on Nginx ( again i don't know if Nginx can access the database and authenticate the request it got)</li>
  <li>Use GridFS with mongoDB? (i will probably not use this, but wanna see if this can be a solution)</li>
  </ul>
  
  <p>is there any other way to do this? </p>