.ejs file refers to EmbeddedJS templates.
What is it? -- Its basically a template engine for NodeJS
What are templates? -- They're sort HTML files with direct integration with the Server so that you can build Html files with dynamic values generated in server.
Why they're used when you can build typical Frontend application? -- Well, you'd do alot in frontend app to get it running like hosting, Rest calls to server, blah blah. In case of templates, all values required inside HTML files are served directly from typical variables in server side code so that you can direclty render HTML files from server.
So why don't we use this approach instead of frontend app for everything? -- Hmm, good idea 🤔 as long as you have a simple application, thats why many admin portals follow template based because they're simple and straight forward. If your application is even medium-sized or dynamic UI components, you wouldnt be able to manage it. So, there, you'd have to choose a typical frontend app for that.
Cool, are there any other template engines? -- You'd always have an alternative for any lib in JS ecosystem. Some of them are Handlebars, Mustache, Jade and more.
Incase you want more info on ejs, visit ejs.co
Cheers!