Markdown Converter
Agent skill for markdown-converter
This file provides guidance to WARP (warp.dev) when working with code in this repository.
Sign in to like and favorite skills
This file provides guidance to WARP (warp.dev) when working with code in this repository.
This is a Cloudflare Worker that provides a REST API for interacting with a MySQL database via Cloudflare Hyperdrive. It supports PNP trip and volunteer mapping pages by serving trip data from a MySQL database.
npm run dev # Start local development server on http://localhost:8787/ npm start # Alias for npm run dev
npm test # Run tests with Vitest
npm run deploy # Deploy to Cloudflare Workers
npm run cf-typegen # Regenerate worker-configuration.d.ts from wrangler.jsonc bindings
Run this after modifying bindings in
wrangler.jsonc to update TypeScript types.
This is a minimal Cloudflare Worker with all logic in
src/index.ts. There are no separate route handlers, middleware, or utility modules.
The worker uses Cloudflare Hyperdrive (configured in
wrangler.jsonc) to connect to MySQL:
HYPERDRIVE (accessed via env.HYPERDRIVE in the worker)WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_HYPERDRIVE environment variable for local MySQL connection2d8371c752954d879f96d49819ce014eDatabase connections are created per-request and closed via
ctx.waitUntil(connection.end()).
Currently implements a single endpoint:
prod_forum.vw_lines view with optional filters:
last_post_before: Filter trips before datelast_post_after: Filter trips after dateupdated_last_days: Filter trips updated within N days (defaults to 3 if no filters provided)Query parameters are converted to SQL WHERE clauses with parameterized queries.
Tests use
@cloudflare/vitest-pool-workers for Cloudflare Workers environment simulation. The test file imports cloudflare:test module which provides:
env: Mock environment variables/bindingscreateExecutionContext(): Create execution context for ctx parameterwaitOnExecutionContext(): Wait for ctx.waitUntil() promises before assertionsSELF: Integration-style testing via fetchNote: Current tests in
test/index.spec.ts are boilerplate and don't reflect actual /trips endpoint behavior.
wrangler.jsonc bindings via npm run cf-typegen@cloudflare/vitest-pool-workers for Workers-specific testing