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

cookie-domain

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cookie-domain

Express middleware for dynamically setting the cookie domain.

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
3
Weekly downloads
 
Created
Source

Build Status NPM version David DM

Express middleware for wrapping res.cookie to use some sane defaults for the cookie config.

// Assuming the host is 'foo.bar.com'
var express = require('express');
var cookieDomain = require('cookie-domain');
var app = express();
app.use(cookieDomain());

/*
 *  You can also pass global overrides into cookieDomain
 *  app.use(cookieDomain({ maxAge: 86400 });
 */

app.get('/', function(req, res, next) {
  // Set a cookie using some sane defaults: { domain: '.bar.com', path: '/', maxAge: 31536000000 })
  res.cookie('a', 1);

  // Or override the defaults
  res.cookie('b', 1, { maxAge: 86400 });

  // Express will use maxAge over expires, but cookie-domain will remove maxAge and pass expires if you tell it to
  res.cookie('c', 1, { expires: false });

  // Pass false to tell cookie-domain not to pass options at all.
  res.cookie('d', 1, false);

  res.send('hello world');
});

Installation and Environment Setup

Install node.js (See download and install instructions here: http://nodejs.org/).

Clone this repository

> git clone git@github.com:mantacode/node-cookie-domain.git

cd into the directory and install the dependencies

> cd cookie-domain
> npm install && npm shrinkwrap --dev

Running Tests

Install coffee-script

> npm install coffee-script -g

Tests are run using grunt. You must first globally install the grunt-cli with npm.

> sudo npm install -g grunt-cli

Unit Tests

To run the tests, just run grunt

> grunt spec

Keywords

FAQs

Package last updated on 21 Jul 2014

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