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

nocache

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nocache

Middleware to destroy caching

  • 3.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.4M
decreased by-10.99%
Maintainers
1
Weekly downloads
 
Created

What is nocache?

The nocache package is a middleware for Node.js applications that sets headers to disable client-side caching. This is particularly useful for ensuring that sensitive or frequently updated content is not stored in the user's cache, thereby enforcing content freshness and enhancing security.

What are nocache's main functionalities?

Disabling Caching

This code demonstrates how to use the nocache middleware in an Express application to disable client-side caching for all routes. By calling `app.use(nocache());`, all responses from the server will include headers that instruct the browser not to cache the content.

const express = require('express');
const nocache = require('nocache');

const app = express();

app.use(nocache());

app.get('/', (req, res) => {
  res.send('Hello, World!');
});

app.listen(3000, () => {
  console.log('Server is running on port 3000');
});

Other packages similar to nocache

Keywords

FAQs

Package last updated on 03 Jun 2021

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