![Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack](https://cdn.sanity.io/images/cgdhsj6q/production/6af25114feaaac7179b18127c83327568ff592d1-1024x1024.webp?w=800&fit=max&auto=format)
Security News
Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
@sidebase/nuxt-session
Advanced tools
Readme
Nuxt session middleware to persist data across multiple requests, supports many backends via unjs/unstorage: memory, redis, fs, ...
Use the module-playground (see playground below) to play around with the module.
npm i @sidebase/nuxt-session
nuxt.config.ts
:
export default defineNuxtConfig({
modules: ['@sidebase/nuxt-session'],
})
event.context.session
that looks like:
{
id: 'TLyEy2Mav2G_sawgek7fqqj6EaWrO9LDAfLjhjHRKbE6M-_nGhT1iK7sTwqZ-xoT',
createdAt: '2022-10-12T09:12:38.406Z'
}
All modifications of ``event.context.session` will automatically be stored. Here's an endpoint that persists a counter per user:
// File: `playground/server/api/count.get.ts`
export default defineEventHandler(async (event: CompatibilityEvent) => {
// Get the current count or set to 0 if this is the first request
const currentCount = event.context.session.count || 0
// Increase the count
event.context.session.count = currentCount + 1
// Return the count
return event.context.session.count
})
To use the session on the client side (i.e., in your client app) you could create an endpoint that returns the session (or a part of it):
// File: `server/api/me.get.ts`
export default defineEventHandler((event: CompatibilityEvent) => event.context.session)
An example page making use of nuxt-session
:
See the playground to interactively use this:
> git clone https://github.com/sidebase/nuxt-session
> cd nuxt-session
> npm i
> npm run dev:prepare
> npm run dev
# -> open http://localhost:3000
npm run dev:prepare
to generate type stubs.npm run dev
to start playground in development mode.npm run lint
to run eslintnpm run type
to run typescheck via tscFAQs
**DEPRECATION NOTICE:** `nuxt-session` will be depreacated at the 11.12.2023 - read https://github.com/sidebase/nuxt-session/issues/91 for reasoning and process. We recommend migrating to [`h3` sessions](https://github.com/unjs/h3#session) for your applic
The npm package @sidebase/nuxt-session receives a total of 869 weekly downloads. As such, @sidebase/nuxt-session popularity was classified as not popular.
We found that @sidebase/nuxt-session demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.
Security News
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.