Live data from Hacker News

You can serve static data over HTTP

ignore.pl

91–100 of 127 posts

Re: You can serve static data over HTTP

#92

This technique of producing an “API” from directories of json generated by batch jobs and creative use of symlinks can be surprisingly effective. I wrote a simple program to transform a list of RSS feeds into a directory tree that I’ve been using for years as my feed reader API to great effect.

We do this at https://endoflife.date API, and it works quite well.

I really like endoflife! It's great for looking up dates with a consistent UI and also codenames - I could never learn that Debian Bullseye was 11 or all the other silly codenames so I look them up here. Thank you!

We also do something similar on Datatig, which is a tool I'm writing for the general situation of crowdsourcing data in Git repos. It makes it easier for people to submit data and then creates usable data and handy websites. The static website output has an API which is just static JSON files. https://pypi.org/project/DataTig/ or https://datatig.readthedocs.io/en/latest/

Re: You can serve static data over HTTP

#93
post #22

caddy file-server does this, but more production-ready, honors cache headers, sets Etag, etc. Also: caddy respond can be used to hard-code specific responses if you're testing an HTTP client. It can even spin up on a whole port range and supports templates in the response text right there on the command line: caddy respond --listen :2000-2004 "I'm server {{.N}} on port {{.Port}}" Here's an example maintenance page: c…

Is caddy that easy to setup and run?

Yes.

Caddy excels at making simple [1] use-cases trivial - either with no config, or 3-5 lines of config.

It might seem jarring comming from Apache or nginx - but i think a lot of it comes from the developers having destilled a lot of common use-cases and carefully chosen reasonable defaults.

[1] Simple to articulate; not necessarily simple to execute - eg letsencrypt works out of the box. Caddy will give you https if you ask (or rather unless you go out of your way to avoid it).

It can be a great stop-gap in running an ssl proxy in front of a legacy application server stuck on some horrible old distro, for example - since the binary just needs a Linux kernel (and can ignore old ssl libraries).

Re: You can serve static data over HTTP

#94
post #54

Earlier quoted context omitted.

Democratization of software engineering means giving everyone the opportunity to learn. Not handing them a black box with a few instructions then sending them off to plow head first into a brick wall of insurmountable knowledge gaps so they give up.

Democratization of software means that more people than ever can make things. This is absolutely the case with software today. We have kids creating games with drag-and-drop visual programming languages. One developer can get a worthy full-stack prototype in front of an investor in a month (or less!), and these stories are gaining steam. Soon we may have no-code solutions getting good enough to warrant broader adopti…

Someone wrote "if people are using your tool to turn out a lot of half-baked garbage, then your tool is a huge success", which really reframed my view on these things. It was originally in the context of one of the "game maker" tools, but applies to any kind of simplification.

A tool which only allows perfect solutions by perfect users is one that rejects a lot of work and prevents a huge number of projects from ever happening at all. Useful for safety-critical work, but not everything is safety-critical.

Re: You can serve static data over HTTP

#96
post #39

Not from a modern developer. You need to jump down the rabbit hole of the history of solid and proven solutions. Indeed. I've noticed an increasing number of people who call themselves "developers" and appear to create software, but all they can do is follow step-by-step tutorials to glue together some massively bloated thing that they have absolutely no understanding of, much less the skills to debug it when somethi…

At some point, the plane flew so high above the clouds, and it hasn't seen the ground for so long, the passengers might think the clouds is the ground.

When "Hello World" is a cloud instance spun up and billed on your tuition.

That won't really happen, right? No Computer Science (CS) professor would designate special cloud Interactive Development Environments (IDEs) to students.

On the other hand, it would really resolve a lot of "doesn't work on my machine" issues.

Re: You can serve static data over HTTP

#97

Earlier quoted context omitted.

You might not want them in your team maybe, but isn’t it really cool we reached a state where you can actually do this? Democratization of software engineering is a great good!

Dunno if it actually is democratizing software engineering. Looks more like a cargo cult to me. You get a second class of developers that don't quite get it. Not because they aren't capable, but because nobody shared the secrets with them and they had to piece together everything from flotsam.

Cargo cult programming is a starting point. Plenty of people won't go any further, but when what you're putting together is all source code, it's mostly transparent boxes you're putting together. You can look inside and see the secrets whenever you want, if you ever want.

Sure, maybe there's some design principles to share that aren't obvious. But it's hard to share and teach those before someone has experience with at least putting stuff together. Also, it's not like there are principles that are universally accepted or universally applied by trained software engineers.

Re: You can serve static data over HTTP

#98
post #39

Earlier quoted context omitted.

At some point, the plane flew so high above the clouds, and it hasn't seen the ground for so long, the passengers might think the clouds is the ground.

When "Hello World" is a cloud instance spun up and billed on your tuition. That won't really happen, right? No Computer Science (CS) professor would designate special cloud Interactive Development Environments (IDEs) to students. On the other hand, it would really resolve a lot of "doesn't work on my machine" issues.

I think that would be a great way to make a weeder course?

Setup some obscure software, with poor documentation, build something nice on top of it, then rewrite it because some fundamental assumption is broken, sounds like this kind of first year of cs course we should have.

The idea being weeding out those not as passionate about computers.

Re: You can serve static data over HTTP

#99
post #72
post #60

> It's not illegal to use static files and it does work. No, it doesn't. Maybe for your personal homepage with three hits per month, but even on a low traffic server, static files gave me headaches. 1) When two visitors write to the file at the same time, the data of one of the visitors will be gone. This can be solved by using lock files. This is a topic on its own (what happens when two processes both create a lock…

If there's writing going on, you're not using static files.

Then I'm mistaken.
Post reply on HN