Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-template-cache

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-template-cache

Adds cached rendering of templates to Express.

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Express Template Cache

express-template-cache is a simple and lightweight module that adds cached rendering of templates to Express. It is useful for serving static pages that only need to be rendered once.

The first time a particular template is requested, it is rendered and the result is cached to memory. Subsequent requests will simply be served from the cache, instead of rendering the template again. This eliminates the need to manually render templates for static pages, while keeping page load times to a minimum.

Installation

npm:

$ npm install express-template-cache

Usage

To use this module, just require('express-template-cache'), and it will monkey-patch Express, adding the res.renderStatic() method. It is used in the exact same way as res.render(), however it implements the caching strategy described above.

require('express-static-render');

app.get('/', function(req, res) {
    res.renderStatic('index', { title: 'My Awesome Website' });
});

Planned Features

  • HTTP Cache-Control and conditional GET support
  • Way to define unique views to be rendered other than just by name

FAQs

Package last updated on 18 Apr 2012

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc