Posted
14 days ago

Add a webhook endpoint to AdonisJS web app | FIXED

I'm just getting started with AdonisJS, I used the web app template, and now I need to add a webhook endpoint, so I can receive events from third-party platforms(such as payments) how can I do that.

Excuse my newbie question.

UPDATE

Fixed it, it was just an issue of the Shield middleware.

Join The Discussion! (3 Replies)

Please sign in or sign up for free to join in on the dicussion.

  1. Commented 13 days ago

    Glad to hear you were able to get it figured out, Hexacker!

    For anyone else who may come across this, you want to make sure you have CSRF disabled for the route, which is in config/shield.ts:

    /**
     * Configure CSRF protection options. Refer documentation
     * to learn more
     */
    csrf: {
      enabled: env.get('NODE_ENV') !== 'test',
      exceptRoutes: ['/stripe/webhook'], // 👈 add your webhook route(s) here
      enableXsrfCookie: true,
      methods: ['POST', 'PUT', 'PATCH', 'DELETE'],
    },
    Copied!
    1

    Please sign in or sign up for free to reply

    1. Commented 13 days ago

      That was a better solution than mine.

      Thank you for the amazing content you're sharing 😊 because of you I'm switching from NestJS to AdonisJS 😎.

      1

      Please sign in or sign up for free to reply

      1. Commented 13 days ago

        Thank you for watching!! 😊 That's awesome to hear, thanks Hexacker!! I hope you enjoy your time with AdonisJS!! 😁

        1

        Please sign in or sign up for free to reply