A module to easily use VineJS in Nuxt for for server-side validation!
nuxt-vine dependency to your project# Using pnpm
pnpm add -D nuxt-vine
# Using yarn
yarn add --dev nuxt-vine
# Using npm
npm install --save-dev nuxt-vine
nuxt-vine to the modules section of nuxt.config.tsexport default defineNuxtConfig({
modules: [
'nuxt-vine'
]
})
That’s it! You can now use Nuxt Vine in your Nuxt app ✨
This plugin automatically imports composable functions into your Nitro routes.
export default defineEventHandler(async (event) => {
const { title } = await validateBody(event, {
title: v.string()
})
// If validation failed, an error will be thrown and handled by this package.
return title
})
v is an alias for vine.
You can use:
validateBody to validate the body of a requestvalidateQuery to validate the query of a requestvalidateParams to validate the params of a request# Install dependencies
npm install
# Generate type stubs
npm run dev:prepare
# Develop with the playground
npm run dev
# Build the playground
npm run dev:build
# Run ESLint
npm run lint
# Run Vitest
npm run test
npm run test:watch
# Release new version
npm run release
Thanks Atinux for the initial works!
We use cookies
We use cookies to analyze traffic and improve your experience. You can accept or reject analytics cookies.