Skip to content

Instantly share code, notes, and snippets.

@slowtick
slowtick / expressAsyncHandler.ts
Last active December 4, 2020 03:17
express js wrapper for using async function to handle requests
import express from 'express';
type AsyncRouteHandlerType = (request: express.Request, response: express.Response, next: express.NextFunction) => Promise<void>;
/**
* Wraps async router function, calls the function with router args and invokes next function on exceptions.
* @example
* import express from 'express';
* const router = express.Router();
* router.get('/thing/list', asyncRouteHandler(listThings));
@slowtick
slowtick / dialogflow-fulfillment.d.ts
Created August 2, 2019 08:59 — forked from diegodalbosco/dialogflow-fulfillment.d.ts
Fix payload constructor parameters
declare module 'dialogflow-fulfillment' {
import { DialogflowConversation } from 'actions-on-google';
import { Request, Response } from 'express';
export class Card extends RichResponse {
constructor(card: string | object);
public setButton(button: {
text: string,
url: string,