mynewprojectjxnReactStream7 matches
34const useMiddleware = Array.isArray(opts); // for backwards compat
35const options: ReactStreamOptions = !Array.isArray(opts) ? opts : {};
36const { api, getInitialProps } = options;
3738if (typeof document !== "undefined" && module) {
48// DEPRECATED (for backwards compat)
49options.robots && robots(options.robots),
50options.api && deprecatedCustomAPI(options.api),
51options.getInitialProps && deprecatedGetInitiaProps(options.getInitialProps),
52// New custom middleware
127// DEPRECATED
128// DEPRECATE (for backwards compat)
129const deprecatedCustomAPI = (api?: RequestHandler): Middleware => async (req, res, next) => {
130if (!api) return next();
131if (req.method === "GET") return next();
132return api(req);
133};
134const deprecatedGetInitiaProps = (getProps: DataFetcher<any>): Middleware => async (req, res, next) => {
142/** DEPRECATED: Optional text response for robots.txt */
143robots?: string;
144/** DEPRECATED: Optional API request handler for all non-GET methods */
145api?: RequestHandler;
146/** DEPRECATED: data fetcher to set initial props based on request */
147getInitialProps?: DataFetcher<any>;
openTownieMadeThis1README.md5 matches
7```
8├── backend/
9│ └── index.ts # Main API entry point using Hono
10├── frontend/
11│ ├── index.html # Main HTML template
26- Accessibility options
27- "Find Hotels" button
28- API endpoints for:
29- Hotel data
30- Special offers
37- **Frontend**: HTML, CSS, and vanilla JavaScript
38- **Styling**: Custom CSS with responsive design
39- **API**: RESTful endpoints for data
4041## How to Use
442. The application serves the frontend/index.html file at the root URL
453. Static assets are served from the /static route
464. API endpoints are available at /api/hotels and /api/offers
4748## Development
532. Update styles in frontend/style.css
543. Modify JavaScript functionality in frontend/index.js
554. Extend the API by adding new endpoints in backend/index.ts
5657## Notes
openTownieMadeThis1index.ts4 matches
17});
1819// API endpoint for hotel data
20app.get("/api/hotels", (c) => {
21return c.json([
22{ id: 1, name: "Disneyland Hotel", price: 450 },
27});
2829// API endpoint for offers
30app.get("/api/offers", (c) => {
31return c.json([
32{
openTownieMadeThis1index.js3 matches
74
75try {
76const response = await fetch('/api/hotels');
77const hotels = await response.json();
78
102getOfferDetailsBtn.addEventListener('click', async () => {
103try {
104const response = await fetch('/api/offers');
105const offers = await response.json();
106const mainOffer = offers[0]; // Get the first offer (Anniversary offer)
114viewAllOffersBtn.addEventListener('click', async () => {
115try {
116const response = await fetch('/api/offers');
117const offers = await response.json();
118
OpenTowniesystem_prompt.txt7 matches
98- For AI-generated images, use: `https://maxm-imggenurl.web.val.run/the-description-of-your-image`
99- **Storage:** DO NOT use the Deno KV module for storage
100- **Browser APIs:** DO NOT use the `alert()`, `prompt()`, or `confirm()` methods
101- **Weather Data:** Use open-meteo for weather data (doesn't require API keys) unless otherwise specified
102- **View Source:** Add a view source link with `import.meta.url.replace("esm.town", "val.town")` and include `target="_top"` attribute
103- **Error Debugging:** Add `<script src="https://esm.town/v/std/catch"></script>` to HTML to capture client-side errors
104- **Error Handling:** Only use try...catch when there's a clear local resolution; avoid catches that merely log or return 500s - let errors bubble up with full context
105- **Environment Variables:** Use `Deno.env.get('keyname')` and minimize their use - prefer APIs without keys
106- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser
107- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
188189### Backend (Hono) Best Practices
190- Hono is the recommended API framework (similar to Express, Flask, or Sinatra)
191- Main entry point should be `backend/index.ts`
192- **Static asset serving:** Use the utility functions to read and serve project files:
209});
210```
211- Create RESTful API routes for CRUD operations
212- Be careful with error handling as Hono tends to swallow errors
213- Consider re-throwing errors to see full stack traces:
226- Use React 18.2.0 consistently in all imports and the `@jsxImportSource` pragma
227- Follow the React component pattern from the example project
228- Handle API calls properly with proper error catching
229230### Database Patterns
257- For files in the project, use `readFile` helpers
2582595. **API Design:**
260- `fetch` handler is the entry point for HTTP vals
261- Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
OpenTowniesoundEffects.ts4 matches
45/**
6* Plays a bell sound notification using the Web Audio API
7* @returns A Promise that resolves when the sound has started playing
8*/
13const AudioContext = window.AudioContext || (window as any).webkitAudioContext;
14if (!AudioContext) {
15console.warn("Web Audio API not supported in this browser");
16resolve();
17return;
6566/**
67* Plays a simple notification sound using the Web Audio API
68* This is a simpler, shorter bell sound
69* @returns A Promise that resolves when the sound has started playing
75const AudioContext = window.AudioContext || (window as any).webkitAudioContext;
76if (!AudioContext) {
77console.warn("Web Audio API not supported in this browser");
78resolve();
79return;
OpenTownieCreateBranch.tsx1 match
43
44try {
45const response = await fetch("/api/create-branch", {
46method: "POST",
47headers: {
OpenTownieBranchControl.tsx2 matches
37setIsLoadingBranches(true);
38try {
39const response = await fetch(`/api/project-branches?projectId=${projectId}`, {
40headers: {
41"Authorization": `Bearer ${bearerToken}`,
107const fetchBranches = async () => {
108try {
109const response = await fetch(`/api/project-branches?projectId=${projectId}`, {
110headers: {
111"Authorization": `Bearer ${bearerToken}`,
21});
2223// API endpoint to crawl a website
24app.post("/api/crawl", async c => {
25try {
26const { url, depth = 3 } = await c.req.json();