A Node.js command line program with zero dependencies (nothing except the UpLeveled ESLint config dependencies in "dependencies" or "devDependencies" in package.json) that will creates a web server that runs on localhost.
This server returns the content of all files in a directory called public.
For example, assume that you are running the server on localhost:3000, and you have the following file in the public folder:
memes/index.htm
memes/1.jpg
index.html
index.css
For this situation, the following behavior should be observable:
http://localhost:3000andhttp://localhost:3000/index.htmlshould return the webpage in theindex.htmlfilehttp://localhost:3000/index.cssshould return the text content of the filehttp://localhost:3000/memesandhttp://localhost:3000/memes/index.htmshould return the webpage in theindex.htmfilehttp://localhost:3000/1.jpgshould display the1.jpgimagehttp://localhost:3000/non-existent-file.txtshould return a404status code and a message about the file not being found
Of course, these are just examples - the server should is able to handle any files and folders that anyone adds to the public folder.
- Security: users cannot request files outside of the
publicdirectory - Returns the correct
Content-Typeheader for the file type