Live data from Hacker News

Show HN: Nano-web – a low latency one binary webserver designed for serving SPAs

github.com

11–20 of 119 posts

Re: Show HN: Nano-web – a low latency one binary webserver designed for serving SPAs

#11

By the way, is there a really minimal, really fast, reasonably secure, zero-cofig single-binary web server which would only support HTTP GET and just expose all the static content in a given directory over it?

I wrote filed[0] for this. It is VERY fast in terms of low-latency (it doesn't even open the file its serving if it can help it) -- although it doesn't generate a dynamic directory listing, so it may not meet your needs if you want any dynamic content like that.

[0] https://filed.rkeene.org/

Re: Show HN: Nano-web – a low latency one binary webserver designed for serving SPAs

#12

Can you elaborate "CloudFront doesn't support index pages in subdirectories" and how does it not work? I'm not much into them these days but if I remember correctly in the 4-5 years prior, they just works! In-fact, CloudFront was easier to serve static web assets than serving directly from S3. Or have I misunderstood what you meant?

Yeah maybe I'm misunderstanding what this person is referring to, but cloudfront definitely supports index pages in any directory

Re: Show HN: Nano-web – a low latency one binary webserver designed for serving SPAs

#13

Can you elaborate "CloudFront doesn't support index pages in subdirectories" and how does it not work? I'm not much into them these days but if I remember correctly in the 4-5 years prior, they just works! In-fact, CloudFront was easier to serve static web assets than serving directly from S3. Or have I misunderstood what you meant?

[deleted]

Re: Show HN: Nano-web – a low latency one binary webserver designed for serving SPAs

#14

By the way, is there a really minimal, really fast, reasonably secure, zero-cofig single-binary web server which would only support HTTP GET and just expose all the static content in a given directory over it?

I can recommend redbean[1], it's basically a webserver and your static files in a zip file that is executable on basically any computer. It's also super small, includes TLS and reasonably fast.

[1] https://redbean.dev

Re: Show HN: Nano-web – a low latency one binary webserver designed for serving SPAs

#15

By the way, is there a really minimal, really fast, reasonably secure, zero-cofig single-binary web server which would only support HTTP GET and just expose all the static content in a given directory over it?

you might want to write your own; i hacked httpdito together for this purpose one weekend. you won't find anything that beats it on 'really minimal' by more than 2 kibibytes :)

readme: http://canonical.org/~kragen/sw/dev3/httpdito-readme

source (single file): http://canonical.org/~kragen/sw/dev3/server.s

it might be reasonable to configure its port and mime types map on the command line instead of in the source, but at the moment it's arguably a bit too zero-configuration

it runs on linux, can handle about 20000 hits per second, has about 20 kilobytes of memory footprint when idle, and needs another 4 kilobytes per concurrently open connection (though the kernel needs several times that)

20000 hits per second is not really fast in the sense that other servers on the same hardware and kernel can handle more than twice that, but it can saturate a gigabit pipe if your files average 7 kilobytes or more

Re: Show HN: Nano-web – a low latency one binary webserver designed for serving SPAs

#16

Can you elaborate "CloudFront doesn't support index pages in subdirectories" and how does it not work? I'm not much into them these days but if I remember correctly in the 4-5 years prior, they just works! In-fact, CloudFront was easier to serve static web assets than serving directly from S3. Or have I misunderstood what you meant?

In a SPA, you want to change routes in the URL so you don’t break people’s expectations about being able to share deep links to specific pages, but those sites don’t really exist. Eg if your site is www.example.com and you have a SPA on there, and one of the pages is www.example.com/products, you want to still serve index.html from the root even though the /products path is not a real directory on your system. If you don’t serve for this URL then it’ll work fine locally but if someone hard-refreshes or shares the link, it won’t load.

Re: Show HN: Nano-web – a low latency one binary webserver designed for serving SPAs

#18

By the way, is there a really minimal, really fast, reasonably secure, zero-cofig single-binary web server which would only support HTTP GET and just expose all the static content in a given directory over it?

Yeah, Vercel created a tool for such case called serve. https://www.npmjs.com/package/serve

Re: Show HN: Nano-web – a low latency one binary webserver designed for serving SPAs

#20

By the way, is there a really minimal, really fast, reasonably secure, zero-cofig single-binary web server which would only support HTTP GET and just expose all the static content in a given directory over it?

This is that. Unless you mean having a directory listing, in which case, it is not.
Post reply on HN