Skip to content

Instantly share code, notes, and snippets.

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

Shem Leong lyzs90

🏠
Working from home
View GitHub Profile
@lyzs90
lyzs90 / handler.ts
Created June 29, 2022 16:01
Next.js Stripe Webhook Handler
import { NextApiRequest, NextApiResponse } from 'next';
import Stripe from 'stripe';
import { Readable } from 'node:stream';
export const config = {
api: {
bodyParser: false,
},
};
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 14,
// font family with optional fallbacks
fontFamily: 'Menlo, "DejaVu Sans Mono", "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.8)',
// Count Query
MongoClient.connectAsync(uri)
.then((db) => {
return db.collection(collection).countAsync(session.userData.selector);
})
.then((count) => {
console.log(`Success: Total of ${count} records`);
session.userData.count = count;
})
.catch((err) => {
let replyMessage = new builder.Message(session).text('To see what\'s available nearby, just send me your location.');
replyMessage.sourceEvent({
facebook: {
quick_replies: [{
content_type: 'location'
}]
}
});
session.send(replyMessage);