Socket
Socket
Sign inDemoInstall

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


Version published
Maintainers
1
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 28 Oct 2016

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