Live data from Hacker News

A whole website in a single JavaScript file

deno.com

21–30 of 170 posts

Re: A whole website in a single JavaScript file

#21
post #2

> rendered dynamically, just in time, at the edge, close to the user. HTML. You're serving HTML. Doesn't really matter that the server-side language is JS, PHP, or BASIC.

It matters to me as a developer who would choose a hosting environment based on my familiarity with the language I have to write in.

Re: A whole website in a single JavaScript file

#22
post #15

Earlier quoted context omitted.

I think you might have misunderstood the blog post. It is server-side rendering on the edge, shipping nothing more than plain HTML/CSS to the browser. There is no client side JS *at all* here.

I understand the blog post, and the capability itself is neat, but I'm having a hard time understanding the utility in what they are showcasing from the actual example site[0]. As other posters have pointed out, why not do it in HTML from the start? It's more simple and efficient than this -or any- framework. Just drop the ol HTML file on your server and away you go! I understand that the supposed "real" utility in t…

I agree we could have elaborated on auth, API endpoints or parametric routes (maybe a follow up !).

But this example does showcase a few things you don't typically get with a single vanilla HTML file:

- JSX + reusable/shared components

- Multiple URLs / pages

- Tailwind

Re: A whole website in a single JavaScript file

#23
post #11

This starts to make sense when you consider the self-flagellation of a full server-side-rendering production setup that has existed over the past decade, to the point many SPA products completely give up on SSR - or nowadays throw themselves at the walled garden of Vercel/Next.js etc to solve it for them.

I am not a fan of Vercel's strategy, but exactly how is the open source and MIT licensed Next.js a walled garden?

It's not. Next.js works on any platform supporting Node, and Vercel supports more than just Next.js. They support dozens of other frameworks.[0] They do promote Next.js on Vercel, but they don't stop you from using other systems.

[0]: https://vercel.com/new/templates

Re: A whole website in a single JavaScript file

#24
post #13
post #3

"time to interactive: 1.0s / first content paint 1.0s" My man, let me introduce you to ... HTML. It has "time to interactive" at 0.0 seconds and content paints instantly!

I think it's actually much worse than that - it's a little tricky to tell on mobile, but going from "stats" to "bagle" and back again - looks like this mucks up the client side cache? While one whole second is "90s slow" for a first render for a static site - it's truly ludicrous for navigating back to an already cached page? How are the cache control headers with this set-up - is there a varnish or similar cdn/cache…

The request headers have no-cache set. I assume this is because it's in a live developer playground page instead of a production deployment.

Re: A whole website in a single JavaScript file

#25
post #5
post #2

> rendered dynamically, just in time, at the edge, close to the user. HTML. You're serving HTML. Doesn't really matter that the server-side language is JS, PHP, or BASIC.

Aaron from Deno here. Of course it's producing HTML as an output, but the point is that you can use JSX and familiar technologies like tailwind to dynamically generate that HTML at edge vs client side. And unlike a pure static site, you can add API or form routes

Oh. So you've reinvented PHP. Nice.

Re: A whole website in a single JavaScript file

#26
post #11

Earlier quoted context omitted.

I am not a fan of Vercel's strategy, but exactly how is the open source and MIT licensed Next.js a walled garden?

It's not. Next.js works on any platform supporting Node, and Vercel supports more than just Next.js. They support dozens of other frameworks.[0] They do promote Next.js on Vercel, but they don't stop you from using other systems. [0]: https://vercel.com/new/templates

Ever since Vercel killed `now`'s ability to serve an index.html with `now .`, I stopped being a fan. That and the pricing blunders have unfortunately pushed me away.

On the other hand, https://docs.ycombinator.lol/ has been running for years without me ever having to worry once, so there's that. Maybe it's time to give them another try.

Re: A whole website in a single JavaScript file

#27
post #22
post #15

Earlier quoted context omitted.

I understand the blog post, and the capability itself is neat, but I'm having a hard time understanding the utility in what they are showcasing from the actual example site[0]. As other posters have pointed out, why not do it in HTML from the start? It's more simple and efficient than this -or any- framework. Just drop the ol HTML file on your server and away you go! I understand that the supposed "real" utility in t…

I agree we could have elaborated on auth, API endpoints or parametric routes (maybe a follow up !). But this example does showcase a few things you don't typically get with a single vanilla HTML file: - JSX + reusable/shared components - Multiple URLs / pages - Tailwind

I get that after reading your blog post, so that's fair. Maybe it's just a case of the magic trick that's missing that third act.

Clicking around with the Dev Console open and watching the pages in Sources was enjoyable.

Re: A whole website in a single JavaScript file

#28
post #25
post #5

Earlier quoted context omitted.

Aaron from Deno here. Of course it's producing HTML as an output, but the point is that you can use JSX and familiar technologies like tailwind to dynamically generate that HTML at edge vs client side. And unlike a pure static site, you can add API or form routes

Oh. So you've reinvented PHP. Nice.

Wow toxic much? PHP doesn't solve the same problems as JSX

Re: A whole website in a single JavaScript file

#29
post #25
post #5

Earlier quoted context omitted.

Aaron from Deno here. Of course it's producing HTML as an output, but the point is that you can use JSX and familiar technologies like tailwind to dynamically generate that HTML at edge vs client side. And unlike a pure static site, you can add API or form routes

Oh. So you've reinvented PHP. Nice.

es6 is much more pleasurable to code than PHP. Check Little Javascripter [0]

[0] https://www.crockford.com/little.html

Re: A whole website in a single JavaScript file

#30
I don't think most of the people commenting here realize that the entire site loads just fine with Javascript disabled. Essentially this is HTML getting generated on the server.

The fact that it is in Deno rather than PHP, Ruby or Python is the point of the article.

Post reply on HN