<story><title>A whole website in a single JavaScript file</title><url>https://deno.com/blog/a-whole-website-in-a-single-js-file</url></story><parent_chain><item><author>lhorie</author><text>I mean, this is a &amp;quot;single file website&amp;quot; in the sense that `&amp;lt;iframe src=&amp;quot;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;google.com&amp;quot;&amp;gt;&amp;lt;&amp;#x2F;iframe&amp;gt;&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;google.com&amp;quot;&amp;gt;&amp;lt;&amp;#x2F;iframe&amp;gt;&lt;/a&gt;` is a &amp;quot;search engine implementation in one line of code&amp;quot;.&lt;p&gt;The only semi-interesting thing here is that this demo pulls dependencies from 3rd party registries via HTTP without an explicit install step. It&amp;#x27;s really not that different than doing regular Node.js development with a committed node_modules (hi, Google), except that if node.land or crux.land go down, you&amp;#x27;ve lost your reproducibility.&lt;p&gt;The thing about &amp;quot;familiar&amp;#x2F;modern techonologies&amp;quot; seem like superficial vanity. A vanilla Node.js equivalent might look something like this&lt;p&gt;&lt;pre&gt;&lt;code&gt;    import {createServer} from &amp;#x27;http&amp;#x27;
    import {parse} from &amp;#x27;url&amp;#x27;

    const route = path =&amp;gt; {
      switch (path) {
        case &amp;#x27;&amp;#x2F;&amp;#x27;: return home()
        case &amp;#x27;&amp;#x2F;about&amp;#x27;: return about()
        default: return error()
      }
    }

    const home = () =&amp;gt; `Hello world`
    &amp;#x2F;&amp;#x2F; etc...

    createServer((req, res) =&amp;gt; {
      res.write(route(parse(req.url)))
      res.end()
    }).listen(80)
&lt;/code&gt;&lt;/pre&gt;
Which is really not anything to write home about, nor an intimidating monstrosity by any measure. Serving cacheable HTML is really not rocket science, it simply does not require &amp;quot;the latest and greatest&amp;quot; anything.</text></item></parent_chain><comment><author>crowlKats</author><text>I wouldnt say an iframe and this are in any way shape or form comparable. this is a &amp;quot;full-fledged&amp;quot; website.&lt;p&gt;&amp;gt; except that if node.land or crux.land go down, you&amp;#x27;ve lost your reproducibility.&lt;p&gt;Dependencies are cached. This is no different from if npm would go down.&lt;p&gt;&amp;gt; The only semi-interesting thing here is that this demo pulls dependencies from 3rd party registries via HTTP without an explicit install step&lt;p&gt;Given that this seems interesting to you, it seems you haven&amp;#x27;t heard of Deno (&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;deno.land&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;deno.land&lt;/a&gt;). It is not related to node in terms of environment, its a new completely separate runtime.&lt;p&gt;In regards to your node example, this is fairly different:
the dependency pulled in from deno.land is a wrapper around the built-in http server, which does various error handling for you and simplifies the usage.
The router isnt a simple switch statement either; its a URLPattern (the web&amp;#x27;s version of path-to-regexp) based minimal router. Campring these to the node built-ins isnt exactly a fair comparison I would say.&lt;p&gt;Also on top of this, with node you need a configuration to get typescript working, then you need a package.json, etc etc.</text></comment>
<story><title>A whole website in a single JavaScript file</title><url>https://deno.com/blog/a-whole-website-in-a-single-js-file</url></story><parent_chain><item><author>lhorie</author><text>I mean, this is a &amp;quot;single file website&amp;quot; in the sense that `&amp;lt;iframe src=&amp;quot;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;google.com&amp;quot;&amp;gt;&amp;lt;&amp;#x2F;iframe&amp;gt;&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;google.com&amp;quot;&amp;gt;&amp;lt;&amp;#x2F;iframe&amp;gt;&lt;/a&gt;` is a &amp;quot;search engine implementation in one line of code&amp;quot;.&lt;p&gt;The only semi-interesting thing here is that this demo pulls dependencies from 3rd party registries via HTTP without an explicit install step. It&amp;#x27;s really not that different than doing regular Node.js development with a committed node_modules (hi, Google), except that if node.land or crux.land go down, you&amp;#x27;ve lost your reproducibility.&lt;p&gt;The thing about &amp;quot;familiar&amp;#x2F;modern techonologies&amp;quot; seem like superficial vanity. A vanilla Node.js equivalent might look something like this&lt;p&gt;&lt;pre&gt;&lt;code&gt;    import {createServer} from &amp;#x27;http&amp;#x27;
    import {parse} from &amp;#x27;url&amp;#x27;

    const route = path =&amp;gt; {
      switch (path) {
        case &amp;#x27;&amp;#x2F;&amp;#x27;: return home()
        case &amp;#x27;&amp;#x2F;about&amp;#x27;: return about()
        default: return error()
      }
    }

    const home = () =&amp;gt; `Hello world`
    &amp;#x2F;&amp;#x2F; etc...

    createServer((req, res) =&amp;gt; {
      res.write(route(parse(req.url)))
      res.end()
    }).listen(80)
&lt;/code&gt;&lt;/pre&gt;
Which is really not anything to write home about, nor an intimidating monstrosity by any measure. Serving cacheable HTML is really not rocket science, it simply does not require &amp;quot;the latest and greatest&amp;quot; anything.</text></item></parent_chain><comment><author>CreepGin</author><text>Now, add jsx and ssr to your example, deploy it, then compare with the deno version in terms of performance, code length, and dev time.</text></comment>