Skip to content

Instantly share code, notes, and snippets.

View imlautaro's full-sized avatar
🏠
Working from home

Lautaro Pereyra imlautaro

🏠
Working from home
View GitHub Profile
@imlautaro
imlautaro / mercadopago.ts
Created March 18, 2024 00:05
MercadoPago Webhook Handler for Nuxt
import crypto from 'crypto'
import type { EventHandler, EventHandlerRequest } from 'h3'
export const defineMPWebhookHandler = <T extends EventHandlerRequest, D>(
handler: EventHandler<T, D>
): EventHandler<T, D> => {
return defineEventHandler<T>(async event => {
const runtimeConfig = useRuntimeConfig()
if (!runtimeConfig.mercadopago.webhookSecret) {
console.error('❌ Error: No webhook secret provided')
@imlautaro
imlautaro / build-and-deploy.yml
Last active October 10, 2023 22:02
Workflow to deploy a Nuxt 3 app to GitHub Pages with NPM
name: Build and Deploy
on:
push:
branches:
- main
permissions:
contents: write
jobs:
build-and-deploy:
concurrency: ci-${{ github.ref }}
@imlautaro
imlautaro / build-and-deploy.yml
Last active October 10, 2023 22:02
Workflow to deploy a Nuxt 3 app to GitHub Pages with PNPM
name: Build and Deploy
on:
push:
branches:
- main
permissions:
contents: write
jobs:
build-and-deploy:
concurrency: ci-${{ github.ref }}