tgh-flavours
v0.1.0
Published
Lightweight wrapper for Tampa General Hospital Flavours cafeteria menu.
Maintainers
Readme
tgh-flavours
Lightweight Node.js wrapper around Tampa General Hospital Flavours cafeteria menu data.
It fetches and parses menu data directly from the public TGH CaterTrax endpoint and returns JSON with calories always included for each item.
Install
npm install tgh-flavoursTest
npm testRequirements
- Node.js
18+(uses built-infetch)
Usage
import {
DietTag,
MealPeriod,
MenuDay,
TghFlavoursClient,
getTghMenu,
} from "tgh-flavours";
const client = new TghFlavoursClient();
const mondayBreakfast = await client.getMenu({
day: MenuDay.Monday,
meal: MealPeriod.Breakfast,
});
const lunchItems = await client.getItems({
meal: MealPeriod.Lunch,
});
const veganOrPlantBased = await client.getItems({
dietaryInfo: [DietTag.VEGAN, DietTag.PLANT_BASED],
});
const mindfulOrVegetarian = await client.getItems({
dietaryInfo: [DietTag.MINDFUL, DietTag.VEGETARIAN],
});
const fullMenu = await getTghMenu();API
new TghFlavoursClient(options?)
Client options:
portalUrl?: stringfetchImpl?: (input, init?) => Promise<Response>requestInit?: RequestInitcache?: { enabled?: boolean; ttlMs?: number }cacheEnabled?: boolean(legacy fallback)cacheTtlMs?: number(legacy fallback)requestTimeoutMs?: number(default:10000)
Disable cache example:
const client = new TghFlavoursClient({
cache: { enabled: false },
});client.getMenu(options?)
Returns structured JSON:
source: source URLs and fetch timestampweek: selected week metadatafilters: applied filtersdays: grouped output by day/group/categoryitems: flattened list of all filtered items
client.getItems(options?)
Returns only the flattened items array.
Query options
day?: string | string[]("Monday","Tuesday", etc.)meal?: string | string[]("breakfast","lunch","dinner","other")dietaryInfo?: DietTag | DietTag[]weekOffset?: numbermenuTitle?: stringincludeEmptyGroups?: booleanincludeRawNutrition?: booleanforceRefresh?: boolean
Item shape
Each item includes:
idnamecalories(number, always present)caloriesTextmindfuldietTagsallergensservingSizedescriptionpricedaymealGroupmealPeriodcategorymenu
Optionally:
rawNutritionwhenincludeRawNutrition: true
Items may contain multiple dietary tags. dietaryInfo accepts one or many enum values and returns items matching any provided dietary tag.
