Skip to content
Discussion options

You must be logged in to vote

So I figured it out, all thanks to @Forsties08!
Here's the code snippets in case someone else is looking for a solution to this:

First, we create a contract contracts/response.ts:

declare module '@ioc:Adonis/Core/Response' {
  interface ResponseContract {
    /**
     * Macro to handle successful response
     * @param  data   Data to be sent in response
     * @param  status status of the response
     * @param  code   code, if applicable. Will fallback to status if not provided
     */
    success(data: any, status?: number, code?: number): this;

    /**
     * Macro to handle erroneous response
     * @param  errors Errors to be sent in response
     * @param  status status of the res…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@joeneldeasis
Comment options

Answer selected by aayush123
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