Auto Generate a Photo Gallery from a Directory in NodeJs

Spread the love

Today am not going to write about express js or node js in this post, as that topics are out of scope for this tutorial, lets focus on topic directly, if you need more information on node js and express js please feel free to visit – https://nodejs.org/, https://expressjs.com/

This project is simple. We will use express web server which does the task of routing and html generation with pug template engine.


Installing dependencies

Save the above json string in the package.json file, and from that folder, open your terminal and type


With issuing above command, node package manager will pull all the required dependencies into node_modules folder under your project root folder.

Create a file called server.js, you can name it as you wish but make sure to update node_modules file.


Here is my view file, which using pug template engine.


Running Project

Just issue following command form the terminal, but before doing that please update folder name and path from where you want to pull images.

Now run http://localhost:8080/get-images, you will get output similar to below,


Read Offline:
Download PDF

Leave a Reply

Your email address will not be published. Required fields are marked *