I'm new to Fresh, and was astounded that this worked:
// index.tsx
import { App } from "jsr:@fresh/core@2.0.0-alpha.25";
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/core@2.0.0-alpha.25";
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.
I'm new to Fresh, and was astounded that this worked:
$ 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 adeno.jsonwith 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.tsxfile: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.