Skip to content

Instantly share code, notes, and snippets.

View KartikBazzad's full-sized avatar
🎯
Focusing

Kartik KartikBazzad

🎯
Focusing
View GitHub Profile
@KartikBazzad
KartikBazzad / router.ts
Created August 13, 2023 07:27
Simple Express similar API Router For ASTRO with middleware support
// Router class
import type { APIContext } from "astro";
type Method = "GET" | "POST" | "PUT" | "DELETE";
type Route = {
method: Method;
uri: string;
callbacks: Array<(context?: APIContext) => any>;
};