7/**
8 * Get all todos, optionally filtered by status
9 * GET /api/todos
10 * GET /api/todos?status=pending
11 */
12todoController.get('/', async (c) => {
30/**
31 * Create a new todo
32 * POST /api/todos
33 */
34todoController.post('/', async (c) => {
73/**
74 * Update an existing todo
75 * PUT /api/todos/:id
76 */
77todoController.put('/:id', async (c) => {
1// CareerCoach20Day/backend/index.ts
2import handler from './api/index.ts';
3
4export default handler;
1# AQI Alerts
2
3**Note: I recently updated the code for this to the OpenAQ v3 API and there might be bugs.**
4
5Get email alerts when AQI is unhealthy near you.
10
111. Click `Remix`
122. Change `location` (Line 4 in [main.tsx](/main.tsx#L4)) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via [nominatim's geocoder API](https://www.val.town/v/stevekrouse/nominatimSearch).
133. Click `Run`
14
1const TARGET_URL = "https://api.openaq.org";
2
3export default async function(req: Request): Promise<Response> {
5 return fetch(TARGET_URL + url.pathname + url.search, {
6 headers: {
7 "X-API-Key": Deno.env.get("OpenAQ_API_KEY") as string,
8 },
9 });
38});
39app.message(async ({ message, say }) => {
40 // Filter out message events with subtypes (see https://api.slack.com/events/message)
41 if (message.subtype === undefined || message.subtype === "bot_message") {
42 const reversedText = [...message.text || ""].reverse().join("");
107 // Steps should be marked as successfully completed using `complete` or
108 // as having failed using `fail`, else they'll remain in an 'In progress' state.
109 // Learn more at https://api.slack.com/automation/interactive-messages
110 // biome-ignore lint/style/noNonNullAssertion: we know this button comes from a step, so `fail` is available.
111 await complete!({ outputs: { user_id: user.id } });
9## Types
10
11- `GitHubCommit` - GitHub API commit response
12- `GitHubPR` - GitHub API pull request response
13- `CommitWithPR` - Combined commit and PR data
14- `ReleaseNote` - Structure for generated release notes
5## Files
6
7- `github.ts` - GitHub API integration for fetching commits and PR data
8- `llm.ts` - OpenAI integration for generating release notes
9- `types.ts` - Type definitions for the backend
10
11## API Endpoints
12
13### POST /api/commits
14
15Fetches commits and associated PR data from GitHub within a specified date range.
48```
49
50### POST /api/generate-notes
51
52Generates user-facing release notes from commit and PR data using OpenAI.
56{
57 "commits": [
58 // Array of commit objects from /api/commits
59 ]
60}
43
44 try {
45 const response = await fetch("/api/user/username", {
46 method: "POST",
47 headers: {
27- **Database**:[Val Town SQLite](https://docs.val.town/std/sqlite/) for storing users, sessions, and magic link tokens
28- **Frontend**: React with Tailwind CSS
29- **Backend**: Hono.js for API routes and middleware
30- **Authentication**: Built by following the [Lucia guide](https://lucia-next.pages.dev/)
31
32## API Endpoints
33
34Provided by the Auth Middleware in `backend/auth.ts`:
38- `POST /auth/logout` - Log out the current user
39
40In the app's API, in `backend/index.ts`:
41
42- `POST /api/user/username` - Update the user's username
43
44## Notes
27});
28
29// API endpoint to update username
30app.post("/api/user/username", async c => {
31 const user = c.get("user");
32