@andrewcaires/cookie
v1.0.4
Published
Plugin for HTTP cookie
Downloads
9
Readme
Cookie
Plugin for HTTP cookie
Installation
npm i @andrewcaires/cookie
Usage
import Cookie from '@andrewcaires/cookie';
Cookie.options({
domain: '',
expires: 86400, // value in milliseconds
path: '/',
secure: false,
});
Api
all
Get all cookies
const cookies = Cookie.all();
check
Check if a cookie exists
const exists = Cookie.check('token');
get
Get a cookie
const token = Cookie.get('token');
remove
Remove a cookie
Cookie.remove('token');
set
Set a cookie
Cookie.set('token', '...');
Cookie.set('token', '...', {
domain: '',
expires: 86400,
path: '/',
secure: false,
});