Doubt how to use Validator AdonisJs 6 #4550
Replies: 1 comment
-
Hi CRodolfosa, welcome to AdonisJS! So the In AdonisJS 6, So, since the validator shared above is for a authentication, you could create a validator file called auth where we can put all validators applicable to authentication within via: node ace make:validator auth Then, within this validator, we can define a specific validator for registration: import vine from '@vinejs/vine'
export const registrationValidator = vine.compile(
vine.object({
email: vine.string().email().trim(),
password: vine.string().minLength(8),
})
) I also have some updated lessons within AdonisJS 6 and VineJS discussing validation as well here: Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm very new to AdonisJs,
I'm following an Adonis5 tutorial and implementing it on Adonis 6.
https://adocasts.com/lessons/adonisjs-user-role-authentication-in-15-minutes
https://github.com/adocasts/user-role-authentication-example/blob/main/app/Controllers/Http/AuthController.ts
I want to create user authentication and Rules using access Token in Adonis 6,
However, the tutorial is on an inferior Adonis and has some changes.
I'm not sure how to create the example validators for my application.
example app:
nessa versão importa
In this version, the validator is used like this:
I'm trying to follow this doc:
https://docs.adonisjs.com/guides/validation
How does my make:validator look?
node ace make:validator schema
node ace make:validator roles
Can anyone guide me?
Beta Was this translation helpful? Give feedback.
All reactions