Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An untapped marketing advantage for Fresh: progressive complexity? #2755

Open
canadaduane opened this issue Nov 9, 2024 · 0 comments
Open

Comments

@canadaduane
Copy link

I'm new to Fresh, and was astounded that this worked:

// index.tsx
import { App } from "jsr:@fresh/[email protected]";

export const app = new App({ root: import.meta.url });

app.get("/", (ctx) =>  new Response(`Hello, World!`));

await app.listen();
$ deno -A index.tsx

 🍋 Fresh ready
    Local:  http://0.0.0.0:8000/

Loading the app in a browser at http://localhost:8000, says "Hello, World!".

This is amazing!

I think you should show this on the front page of the project.

One file. No package.json, no tsconfig.json, no vite.config.js, no src directory, no node_modules directory, no build step, with typescript.

If I were you, I'd be shouting this from the rooftop. I think nodejs devs who are weary of all of the hoops to jump through to get started on a project would come running.

Congrats, this is really cool!

Next, you can add JSX via preact, using a deno.json with 7 lines of configuration:

{
  "imports": { "preact": "npm:preact@^10.24.3" },
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "preact"
  }
}

Now, you can add a button in TSX to the index.tsx file:

import { App } from "jsr:@fresh/[email protected]";

export const app = new App({ root: import.meta.url });

app.get("/", (ctx) => ctx.render(<button>Hello, World!</button>));

await app.listen();

Two files. Amazing.

Maybe you can show how to progressively build a more complex app, but only add complexity when needed. This seems like a wonderful step forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant