There is a function in EJS to render files, you can just do:
ejs.renderFile(__dirname + '/template.ejs', function(err, data) {
console.log(err || data);
});
Source: Official EJS documentation
More Related Contents:
- Render a variable as HTML in EJS
- Node.js – EJS – including a partial
- How to create global variables accessible in all views using Express / Node.JS?
- Loop through JSON in EJS
- Passing an object to client in node/express + ejs?
- How to include external .js file to ejs Node template page
- Displaying an image with EJS in node.js/express
- What is the proper way to check for existence of variable in an EJS template (using ExpressJS)?
- How do you turn a Mongoose document into a plain object?
- How to edit a node module installed via npm?
- Setting expiry time for a collection in mongodb using mongoose
- Create a HOC (higher order component) for authentication in Next.js
- node.js – request – How to “emitter.setMaxListeners()”?
- Proxy with express.js
- How do I host multiple Node.js sites on the same IP/server with different domains?
- Read remote file with node.js (http.get)
- How to use http.client in Node.js if there is basic authorization
- Global npm install location on windows?
- tsc is not recognized as internal or external command
- npm install – javascript heap out of memory
- Fail to install npm package “npm ERR! errno -4048”
- How to send emails with google using nodemailer after Google disabled less sure app option?
- How to pass parameter to mssql query in node js
- Auto reloading a Sails.js app on code changes?
- How/why does npm recommend not running as root?
- Material-UI Rendering Bugs in production / build
- What is the purpose of .bin folder in node_modules?
- Heroku ENOENT: no such file or directory, stat ‘/app/build/index.html’
- Firebase Functions HTTPS 403 Forbidden
- NodeJS: sending/uploading a local file to a remote server