Languages

Node.js - What is the best way to display directory content using Express.js?

5 points
Asked by:
Dragontry
731

I want to share some files with Node.js (Express.js).

I am looking for the best way to display directory content (directories and files inside).

What is the best solution?

1 answer
7 points
Answered by:
Dragontry
731

You can use project made by our contributor:

https://github.com/dirask/dirask-tutorials/tree/master/dirask-tutorials-nodejs/directory-browser

Note: version with password protection is avaialble here.

 

Screenshot:Online Directory Browser by Dirask (Express.js + React)

 

Installation + Running:

  1. install Node.js v16
    Choose one option: Debian/Ubuntu, Windows v1, Windows v2
  2. copy project to your computer/server
  3. install dependecies and build application using Bash script:
    ./build-app.sh
    Note: check this article to know how to install Bash under Windows.
  4. configure SHARED_DIRECTORY_PATH located in backend/.env file,
  5. paste own certificates to backend/ directory or generate new one using:
    openssl.exe req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj '/CN=localhost'
    Note: certificate and his private key are stored in cert.pem and key.pem files.
  6. run application using Bash script:
    ./run-app.sh

 

Note: you can check README.md file also.

 

0 comments Add comment
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join