import { asset, Head } from "$fresh/runtime.ts"; import { Handlers, PageProps } from "$fresh/server.ts"; import Counter from "../islands/Counter.tsx"; import LemonDrop from "../islands/LemonDrop.tsx"; import Footer from "../components/Footer.tsx"; import VERSIONS from "../../versions.json" assert { type: "json" }; import * as FeatureIcons from "../components/FeatureIcons.tsx"; import CopyArea from "../islands/CopyArea.tsx"; import * as Icons from "../components/Icons.tsx"; import Projects from "../components/Projects.tsx"; import projects from "../data/showcase.json" assert { type: "json" }; export const handler: Handlers = { GET(req) { const accept = req.headers.get("accept"); let path = "/docs/concepts/updating"; if (accept && !accept.includes("text/html")) { path = `https://deno.land/x/fresh@${VERSIONS[0]}/update.ts`; } return new Response(`Redirecting to ${path}`, { headers: { "Location": path }, status: 307, }); }, }; const TITLE = "fresh - The next-gen web framework."; const DESCRIPTION = "Just in time edge rendering, island based interactivity, and no configuration TypeScript support using Deno."; export default function MainPage(props: PageProps) { const ogImageUrl = new URL(asset("/home-og.png"), props.url).href; const origin = `${props.url.protocol}//${props.url.host}`; return ( <> {TITLE}
); } function Hero() { return ( <>
Documentation
); } function Features() { const item = "flex md:flex-col items-center gap-5"; const desc = "flex-1 md:text-center"; return (
Just-in-time rendering on the edge.
Island based client hydration for maximum interactivity.
Zero runtime overhead: no JS is shipped to the client by default.
No build step.
No configuration necessary.
TypeScript support out of the box.
); } function Intro() { return (

The next-gen web framework.

Built for speed, reliability, and simplicity.

deno is drinking fresh lemon squash

Fresh embraces the tried and true design of server side rendering and progressive enhancement on the client side.

); } function GettingStarted(props: { origin: string }) { return (

Getting Started

Deno CLI {" "} version 1.25.0 or higher is required.{" "} Install {" "} or{" "} update .

To bootstrap a new project:

{`deno run -A -r ${props.origin} deno-fresh-demo`}

Enter the newly created project directory and run the following command to start the development server:

{`deno task start`}

You can now open{" "} http://localhost:8000 {" "} in your browser to view the page.

A more in-depth{" "} Getting Started {" "} guide is available in{" "} the docs.

); } const timeFmt = new Intl.DateTimeFormat("en-US", { timeStyle: "long", hour12: false, }); function Example() { return (

Example

This text is being server side rendered on the fly. It was rendered at {" "} {timeFmt.format(new Date())}.

The counter below was rendered on the server with a starting value of 3, and was then hydrated on the client to provide interactivity. Try out the buttons!

Only the JS required to render that counter is sent to the client.

); } function Showcase() { return (

Showcase

Below is a selection of projects that have been built with Fresh.

); }