DEV Community

Discussion on: Google Cloud App Engine Environment Variables

Collapse
 
arthur5005 profile image
Arthur Goldsmith

For those with no EJS installed, you can use this render function:

function renderTemplate(template, variables) {
  Object
    .entries(variables)
    .forEach(([key, value]) => {
      template = template.replace(new RegExp(`<% ${key} %>`, 'g'), value);
    });
  return template;
}