advanced

Backend protocol

If you need to define your own backend logic outside Nitro, follow these requirements.

  1. Precognitive Requests must have Precognitive Header { 'Precognitive': 'true' }
  2. To validate specific variables, each keys must be specified inside the ValidateOnly Header, comma separated and leveraging dot notation: { 'Precognition-Validate-Only': 'name,age,address.street,address.number' }
  3. To validate the full Form the ValidateOnly Header should be omitted or define as an empty string.
  4. Successful validation response must have:
  • Precognitive Header { 'Precognitive': 'true' }
  • Precognitive Successful Header { 'Precognition-Success': 'true' }
  • Precognitive Successful status code: 204
  1. Error validation response must have:
  • Precognitive Header { 'Precognitive': 'true' }
  • Precognition-Validate-Only header if needed { 'Precognition-Validate-Only': 'name,age,address.street,address.number' }
  • Validation Error status code: 422
  • Validation Errors and Message will be parsed as per your define logic, or using standard errorParsers if enabled by config:
    • NuxtErrorParsers: Response & { _data: { data: ValidationErrorsData }}
    • LaravelErrorParsers: Response & { _data: ValidationErrorsData }