An open API service indexing awesome lists of open source software.

https://github.com/xarenas107/nuxt-uncsrf


https://github.com/xarenas107/nuxt-uncsrf

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# Nuxt Unscrf

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![License][license-src]][license-href]
[![Nuxt][nuxt-src]][nuxt-href]

My new Nuxt module for doing amazing things.

- [✨  Release Notes](/CHANGELOG.md)

## 🚀 Features

- ⛰ **Nuxt 3 ready**
- 👌 **Zero config**: Configuration for common use cases
- ⚡ **Nitro ready**: Customizable nitro storage.
- ⚙️ **Auto import**: Provide auto import functions.
- 🦾 **Type strong**: Written in typescript

## 📦 Install

```bash
npm i @xarenas107/nuxt-uncsrf -D
```

## 🦄 Usage

> Add `@xarenas107/nuxt-uncsrf` to the `modules` section of `nuxt.config.ts`.

```js
export default defineNuxtConfig({
modules: [
'@xarenas107/nuxt-uncsrf'
]
})
```

By default csrf protection is applied to all routes except for `/_nuxt` and `/__nuxt` with `GET` method. If you need more control, use nitro route rules.

> Use false to disable protection

```js
routeRules:{
'/locale/**': {
uncsrf: false,
}
}
```

> You can customize storage

```js
// define storage on `nuxt.config.ts`
export default defineNuxtConfig({
uncsrf:{
storage:{
driver:'memory'
}
}
})
```

> Or use a previously defined storage'

```js
export default defineNuxtConfig({
nitro:{
storage:{
'security':{
driver:'memory',
}
}
},
uncsrf:{
storage:'security'
}
})
```

That's it! You can now use @nuxt/uncsrf in your Nuxt app ✨

[npm-version-src]: https://img.shields.io/npm/v/@xarenas107/nuxt-uncsrf/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
[npm-version-href]: https://npmjs.com/package/@xarenas107/nuxt-uncsrf

[npm-downloads-src]: https://img.shields.io/npm/dm/@xarenas107/nuxt-uncsrf.svg?style=flat&colorA=18181B&colorB=28CF8D
[npm-downloads-href]: https://npmjs.com/package/@xarenas107/nuxt-uncsrf

[license-src]: https://img.shields.io/npm/l/@xarenas107/nuxt-uncsrf.svg?style=flat&colorA=18181B&colorB=28CF8D
[license-href]: https://npmjs.com/package/@xarenas107/nuxt-uncsrf

[nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js
[nuxt-href]: https://nuxt.com