Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
express-render-template
Advanced tools
Use the HTML source of an external URL as an express layout template (clean iframe alternative)
This package in no longer supported and has been replaced by node-iframe-replacement
Use the HTML source of an external URL as an express layout template, a clean alternative to an iframe.
Extends res.render allowing an external URL to be used as a layout & CSS selector as a placeholder location to inject view content.
$ npm install --save express-render-template
The example below will request the Mammoth Workwear home page and replace the contents of #promo-banner with the contents of the view
var renderTemplate = require('express-render-template');
// replace res.render with renderTemplate version
app.use(renderTemplate);
// create a regular express route
app.get('/', function(req, res){
// call res.render as normal but pass template and selector rather than layout
res.render('view-name',{
template: 'http://mammothworkwear.com', // external url to use as layout page
templateSelector: '#promo-banner' // element within the layout to inject view content
});
});
<h1>20% off <a href="https://northseaworkwear.com/brands-dickies-fr-workwear/">Dickies Workwear</a></h1>
To ensure scripts, styles and images in the external template load on your site, the render method injects a HTML base tag <base href="http://mammothworkwear.com" />
. Therefore you need to ensure any links within your view are absolute.
ISC License © 2016 John Doherty
FAQs
Use the HTML source of an external URL as an express layout template (clean iframe alternative)
The npm package express-render-template receives a total of 21 weekly downloads. As such, express-render-template popularity was classified as not popular.
We found that express-render-template demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.