How to encrypt adonis js 5 response data using middleware #3771
-
I want to encrypt data sent from adonis js 5 response using middleware. public async login(username:string,password:string) Now I want to get hold of this data in adonis js 5 middleware and first encrypt it and then send to client. I am unable to get hold of returned response data in adonis js 5 middleware. Please help me out. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hey @pawan-khade! 👋🏻 What have you tried so far? import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
class EncryptResponseMiddlware {
public async handle({ request }: HttpContextContract, next: () => Promise<void> ) {
await next()
// Your code here
}
} |
Beta Was this translation helpful? Give feedback.
-
thanks for your reply. It worked for me. Thanks @RomainLanz |
Beta Was this translation helpful? Give feedback.
Hey @pawan-khade! 👋🏻
What have you tried so far?
You should create a downstream middleware to alter the response.