TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A Poor Man's API

213 pointsby guoqiover 2 years ago

18 comments

55555over 2 years ago
Check out this simple, easy API replacement: just set up Docker, APISIX, Grafana, Prometheus, etc.<p>Does anyone else miss the old days of just editing your site&#x27;s code and adding new columns to your MYSQL database while people were surfing your website? That was fun.<p>Tip: Another way to turn your DB into an API is to just connect to it and then write SQL queries.
评论 #33784957 未加载
评论 #33783931 未加载
评论 #33784637 未加载
评论 #33790130 未加载
评论 #33785049 未加载
评论 #33787002 未加载
tasukiover 2 years ago
&gt; Creating a full-fledged API [...]. You need to think about [...] the REST principles<p>I can assure you you don&#x27;t need to do that. And most people don&#x27;t.<p>It&#x27;s perfectly possible to create a useful API without adhering to the REST principles.<p>[Edit, having read the rest of the article]: Case in point, this very PostgREST tool promoted in the article appears very useful, while not thinking about the REST principles.
评论 #33784421 未加载
评论 #33785073 未加载
nattaylorover 2 years ago
Reminds me of datasette, which does similar things for SQLite (and much more, too). Docs at <a href="https:&#x2F;&#x2F;docs.datasette.io&#x2F;en&#x2F;stable&#x2F;json_api.html" rel="nofollow">https:&#x2F;&#x2F;docs.datasette.io&#x2F;en&#x2F;stable&#x2F;json_api.html</a><p>Example: Retrieve JSON for <a href="https:&#x2F;&#x2F;fivethirtyeight.datasettes.com&#x2F;polls&#x2F;president_primary_polls" rel="nofollow">https:&#x2F;&#x2F;fivethirtyeight.datasettes.com&#x2F;polls&#x2F;president_prima...</a> simply with <a href="https:&#x2F;&#x2F;covid-19.datasettes.com&#x2F;covid&#x2F;ny_times_us_counties.json?state__exact=Texas&amp;_sort_desc=date" rel="nofollow">https:&#x2F;&#x2F;covid-19.datasettes.com&#x2F;covid&#x2F;ny_times_us_counties.j...</a> (I added a filter for Texas)
评论 #33786216 未加载
colonwqbangover 2 years ago
&gt; when you’ve validated the requirements, you can keep the existing façade and replace PostgREST with your custom-developed API.<p>Why? What is it about postgrest which makes it unsuitable for &quot;real&quot; usage? The author doesn&#x27;t mention it.
评论 #33786456 未加载
评论 #33785896 未加载
评论 #33785922 未加载
评论 #33785541 未加载
maartenhover 2 years ago
Hm, using Apache APISIX for DDoS protection on a single node? That won&#x27;t really stop a real DDoS. Not much you can do on a single server, if a botnet is saturating the network links to your server(s), without help from your infra provider.<p>This setup can be used to prevent the backends from being overloaded, which one can probably already do from a single host, and depending on the speed&#x2F;amount of work by the backends done, not a lot of bandwidth is required to overload most systems that have a limited amount of request processing capacity.<p>I would argue that this is load management&#x2F;shedding though, and not DDoS protection.
评论 #33786473 未加载
sisciaover 2 years ago
Maybe I am biased, but at this point I would find simpler to just give access to the DB.<p>Let user write their own SQL queries and meter how much time they use for billing or abuse prevention.
评论 #33787988 未加载
评论 #33790930 未加载
jlengrandover 2 years ago
That&#x27;s what I actually admire about Supabase [0].<p>The folks created an almost full fledged Firebase replacement by clipping pieces together (similar to the article, replacing APISIX with Kong) and it allows them to iterate super fast.<p>Pragmatic, and nice if you&#x27;re on the receiving end of it .<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;supabase&#x2F;supabase#how-it-works" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;supabase&#x2F;supabase#how-it-works</a>
KronisLVover 2 years ago
Here&#x27;s a page that talks a bit more about Apache APISIX: <a href="https:&#x2F;&#x2F;apisix.apache.org&#x2F;docs&#x2F;apisix&#x2F;getting-started&#x2F;" rel="nofollow">https:&#x2F;&#x2F;apisix.apache.org&#x2F;docs&#x2F;apisix&#x2F;getting-started&#x2F;</a><p>I find it a bit ironic that they don&#x27;t support Apache2 as the web server, you know, it being an Apache project and all, instead going for Nginx or OpenResty (though admittedly they&#x27;re great projects).<p>Even nowadays Apache2 is pretty okay: <a href="https:&#x2F;&#x2F;blog.kronis.dev&#x2F;tutorials&#x2F;how-and-why-to-use-apache-httpd-in-2022" rel="nofollow">https:&#x2F;&#x2F;blog.kronis.dev&#x2F;tutorials&#x2F;how-and-why-to-use-apache-...</a> (especially if you disable .htaccess for less disk I&#x2F;O and use it with a single file based config)
senkoover 2 years ago
Or just use an API generator like <a href="https:&#x2F;&#x2F;apibakery.com" rel="nofollow">https:&#x2F;&#x2F;apibakery.com</a> , <a href="https:&#x2F;&#x2F;amplication.com" rel="nofollow">https:&#x2F;&#x2F;amplication.com</a> or another with your favorite framework and call it a day.
评论 #33786281 未加载
评论 #33786920 未加载
tiborsaasover 2 years ago
This is far from what I&#x27;d call &quot;poor man&#x27;s&quot; thing.<p>I&#x27;d want to host it for free, so Vercel and Netlify comes to my mind. But to go real poor man style, I&#x27;d use Google sheets as a backend and throw some caching layer on top of it. Firebase or one of its competitors is also a good idea to get some API up and running for free.
评论 #33786041 未加载
brianjacobsover 2 years ago
Not to be mean, but from my reading this needs Heroku free tier which no longer exists? I am very sorry if I got that wrong.
评论 #33783816 未加载
评论 #33783594 未加载
评论 #33783709 未加载
评论 #33783935 未加载
pramover 2 years ago
Ehh this seems more annoying than just writing an MVP in (your language of choice) given you already have the expertise.
评论 #33784715 未加载
hanzhangzengover 2 years ago
This is informational and reminds me of that funny github repo porsager&#x2F;postgres. Thanks for sharing this!
bmn__over 2 years ago
&gt; PostgREST is a fast way to construct a RESTful API.<p>That&#x27;s false. The responses don&#x27;t even have hyperlinks.
评论 #33785472 未加载
评论 #33786838 未加载
edgyquantover 2 years ago
Why not just use postgraphile?
评论 #33786906 未加载
12tvendeover 2 years ago
Pretty cool postgress feature
评论 #33785888 未加载
sgtover 2 years ago
Is APISIX any good?
评论 #33785601 未加载
brvierover 2 years ago
Shame ...