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>;
};
@KartikBazzad
KartikBazzad / gist:1cc121208f03a29f331deb62f5b86e49
Last active July 10, 2023 01:08
Config Schema and Parsing Token System
What this is about?
Ans: i am building an music application that takes an config file, that will have a unified schema design and endpoints user can use, the endpoints and their responses can be different for each user, to make it simple i was thinking of making a parsing system, and then parse and use the endpoints and use mappings values to map responses according to our classes/models
there will be other endpoints for song, playlist, album, search, genre
Depending on the endpoints user provides , we show certain ui widgets,
The home,song,playlist endpoint are required
// store.ts
import {
configureStore,
AnyAction,
TypedStartListening,
TypedAddListener,
addListener,
} from "@reduxjs/toolkit";
import {
FLUSH,