← Cloudflare Workers / workers / examples
Получение HTML
Если вы хотите быстро начать, нажмите на кнопку ниже.
Это создаёт репозиторий в вашем аккаунте GitHub и разворачивает приложение в Cloudflare Workers.
export default {
async fetch(request) {
/**
* Replace `remote` with the host you wish to send requests to
*/
const remote = "https://example.com";
return await fetch(remote, request);
},
};export default {
async fetch(request: Request): Promise<Response> {
/**
* Replace `remote` with the host you wish to send requests to
*/
const remote = "https://example.com";
return await fetch(remote, request);
},
};from workers import WorkerEntrypoint
from js import fetch
class Default(WorkerEntrypoint):
async def fetch(self, request):
# Replace `remote` with the host you wish to send requests to
remote = "https://example.com"
return await fetch(remote, request)import { Hono } from "hono";
const app = new Hono();
app.all("*", async (c) => {
/**
* Replace `remote` with the host you wish to send requests to
*/
const remote = "https://example.com";
// Forward the request to the remote server
return await fetch(remote, c.req.raw);
});
export default app;