Skip to content

How to encrypt adonis js 5 response data using middleware #3771

Answered by RomainLanz
pawan-khade asked this question in Help
Discussion options

You must be logged in to vote

Hey @pawan-khade! 👋🏻

What have you tried so far?
You should create a downstream middleware to alter the response.

import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'

class EncryptResponseMiddlware {
  public async handle({ request }: HttpContextContract, next: () => Promise<void> ) {
    await next()

	// Your code here
  }
}

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by RomainLanz
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants