6 <defs>
7 <style>
8 @import url('https://fonts.googleapis.com/css2?family=Pirata+One&display=swap');
9 text {
10 font-family: 'Pirata One', serif;
47 try {
48 // Try to create the SVG file in the svgRenderer project
49 const response = await fetch(`https://api.val.town/v1/projects/${PROJECT_ID}/files`, {
50 method: 'POST',
51 headers: {
2 <defs>
3 <style>
4 @import url('https://fonts.googleapis.com/css2?family=Pirata+One&display=swap');
5 text {
6 font-family: 'Pirata One', serif;
5 <defs>
6 <style>
7 @import url('https://fonts.googleapis.com/css2?family=Pirata+One&display=swap');
8 text {
9 font-family: 'Pirata One', serif;
60 // Get a list of all files in the project
61 const fileListResponse = await fetch(
62 "https://api.val.town/v1/projects/1a0cd106-097f-11f0-b084-569c3dd06744/files?recursive=true",
63 { headers: { "Accept": "application/json" } }
64 );
94 <meta http-equiv="Pragma" content="no-cache">
95 <meta http-equiv="Expires" content="0">
96 <link href="https://fonts.googleapis.com/css2?family=Pirata+One&display=swap" rel="stylesheet">
97 <style>
98 body {
206 <meta http-equiv="Pragma" content="no-cache">
207 <meta http-equiv="Expires" content="0">
208 <link href="https://fonts.googleapis.com/css2?family=Pirata+One&display=swap" rel="stylesheet">
209 <style>
210 body {
11import { rss } from "./rss";
12
13import data from "https://blog.jxnblk.com/api/all.json?d4" with { type: "json" };
14
15interface Params {
1// RSS middleware for jxnblk.com
2
3// import data from "https://blog.jxnblk.com/api/all.json" with { type: "json" };
4import type { Middleware } from "https://esm.town/v/jxnblk/ReactStream";
5
34 const useMiddleware = Array.isArray(opts); // for backwards compat
35 const options: ReactStreamOptions = !Array.isArray(opts) ? opts : {};
36 const { api, getInitialProps } = options;
37
38 if (typeof document !== "undefined" && module) {
48 // DEPRECATED (for backwards compat)
49 options.robots && robots(options.robots),
50 options.api && deprecatedCustomAPI(options.api),
51 options.getInitialProps && deprecatedGetInitiaProps(options.getInitialProps),
52 // New custom middleware
127// DEPRECATED
128// DEPRECATE (for backwards compat)
129const deprecatedCustomAPI = (api?: RequestHandler): Middleware => async (req, res, next) => {
130 if (!api) return next();
131 if (req.method === "GET") return next();
132 return api(req);
133};
134const deprecatedGetInitiaProps = (getProps: DataFetcher<any>): Middleware => async (req, res, next) => {
142 /** DEPRECATED: Optional text response for robots.txt */
143 robots?: string;
144 /** DEPRECATED: Optional API request handler for all non-GET methods */
145 api?: RequestHandler;
146 /** DEPRECATED: data fetcher to set initial props based on request */
147 getInitialProps?: DataFetcher<any>;
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
40
41## 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
47
48## 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
56
57## Notes
17});
18
19// API endpoint for hotel data
20app.get("/api/hotels", (c) => {
21 return c.json([
22 { id: 1, name: "Disneyland Hotel", price: 450 },
27});
28
29// API endpoint for offers
30app.get("/api/offers", (c) => {
31 return c.json([
32 {
74
75 try {
76 const response = await fetch('/api/hotels');
77 const hotels = await response.json();
78
102 getOfferDetailsBtn.addEventListener('click', async () => {
103 try {
104 const response = await fetch('/api/offers');
105 const offers = await response.json();
106 const mainOffer = offers[0]; // Get the first offer (Anniversary offer)
114 viewAllOffersBtn.addEventListener('click', async () => {
115 try {
116 const response = await fetch('/api/offers');
117 const offers = await response.json();
118