From 3b2b73aa5c3d3232e62023f74ea86606fa2f372b Mon Sep 17 00:00:00 2001 From: Aryan Malik <88618913+Aryan9592@users.noreply.github.com> Date: Tue, 17 Oct 2023 21:59:42 +0530 Subject: [PATCH] Create ejs.js --- npm_Modules/EJS/ejs.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 npm_Modules/EJS/ejs.js diff --git a/npm_Modules/EJS/ejs.js b/npm_Modules/EJS/ejs.js new file mode 100644 index 0000000..f7f1a74 --- /dev/null +++ b/npm_Modules/EJS/ejs.js @@ -0,0 +1,20 @@ +const ejs = require('ejs'); + +// Define the template +const template = ` +
Your favorite color is <%= color %> and your age is <%= age %> years old.
+`; + +// Data to be passed to the template +const data = { + name: 'John Doe', + color: 'blue', + age: 30, +}; + +// Render the template with the data +const renderedTemplate = ejs.render(template, data); + +// Output the rendered template +console.log(renderedTemplate);