FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
lightweight

lightweight

bragreel

Public
Like
1
bragreel
Home
Code
7
frontend
1
routes
9
utils
6
README.md
C
cache.tsx
H
index.tsx
C
publish.tsx
Branches
11
Pull requests
Remixes
1
History
Environment variables
1
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
routes
/
README.md
Code
/
routes
/
README.md
Search
5/20/2025
Viewing readonly version of main branch: v156
View latest version
README.md

Routes Directory

This directory contains modular route handlers for the API.

Current Routes

  • favicon.ts: Handles the /favicon endpoint for extracting favicons from URLs

Adding New Routes

To add a new route:

  1. Create a new file in this directory (e.g., myRoute.ts)
  2. Use the following template:
import { Hono } from "https://esm.sh/hono@3.11.7"; // Create a router for the endpoint const router = new Hono(); // Define your routes router.get("/", (c) => { // Handler logic return c.json({ message: "Your response" }); }); router.post("/", async (c) => { // Handler logic for POST const body = await c.req.json(); // Process the request return c.json({ result: "Your response" }); }); // Export the router export default router;
  1. Import and mount your router in the main index.tsx file:
import myRouter from "./routes/myRoute.ts"; // Mount the router app.route("/my-route", myRouter);

This modular approach helps keep the codebase organized and maintainable as the API grows.

FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
ExploreDocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareersBrandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.