DEV Community

pooyaalamdari
pooyaalamdari

Posted on

3

Sure, I can explain what these codes mean line by line. They are part of the Express.js framework, which is a popular web application framework for Node.js¹.

  • app.set('view engine', 'ejs'); This line of code sets the view engine to 'ejs', which stands for Embedded JavaScript. This is a templating language that lets you generate HTML with plain JavaScript². It allows you to use variables, loops, conditionals, and other features in your HTML files.
  • app.set('views', path.resolve('./resource/views')); This line of code sets the views directory to the path that is resolved from the current directory and the './resource/views' string. This means that Express.js will look for the ejs files in the 'resource/views' folder, which is where you should store your templates³.

These two lines of code are necessary to configure the Express.js app to use ejs as the view engine. You can also use other view engines, such as Handlebars or Mustache, but the process

Top comments (0)