TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

What language/framework would be suitable for a new lightweight API project?

11 点作者 dustinfarris超过 10 年前
I want to write a simple API to interface directly with Elasticsearch, almost to the point of being a proxy. I have extensive Python/Django experience, but I'm open to learning something new. Since this is pretty much going to be a CRUD API with some authentication logic, Django feels like overkill. I'm looking at learning Flask, or perhaps something non-Python. Any suggestions?

15 条评论

amirmansour超过 10 年前
If you are keen on learning something new then I definitely recommend looking into Go. It will be time well-spent, and you can use the minimal Gorilla web toolkit (<a href="http://www.gorillatoolkit.org" rel="nofollow">http:&#x2F;&#x2F;www.gorillatoolkit.org</a>). It&#x27;s a toolkit and not a framework, so you can just use the parts that you need, and that&#x27;s nice way of staying &quot;lightweight.&quot;<p>With that said, I wouldn&#x27;t brush off Python as a possible choice. Here are some small&#x2F;lightweight Python web frameworks in addition to Flask (<a href="http://flask.pocoo.org" rel="nofollow">http:&#x2F;&#x2F;flask.pocoo.org</a>):<p>1. Bottle (<a href="http://bottlepy.org" rel="nofollow">http:&#x2F;&#x2F;bottlepy.org</a>). It&#x27;s a one file module and has no dependencies.<p>2. Web.py (<a href="http://webpy.org" rel="nofollow">http:&#x2F;&#x2F;webpy.org</a>). The &quot;anti-framework.&quot; Very simple.<p>3. CherryPy (<a href="http://www.cherrypy.org" rel="nofollow">http:&#x2F;&#x2F;www.cherrypy.org</a>). Another minimal framework that comes with its own WSGI server.<p>All the frameworks mentioned above are stable, mature, and used in production. With that said, any good API these days needs authentication, authorization, and rate-limiting. To get these standard things done from the start you should look at fantastic Django Rest Framework (at least don&#x27;t ignore it). If you do use Django, then you can also use Haystack (<a href="http://haystacksearch.org" rel="nofollow">http:&#x2F;&#x2F;haystacksearch.org</a>) to easily work with Elasticsearch.<p>It&#x27;s hard to give detailed suggestions without knowing the application you are trying to build, but I hope you find this helpful.
评论 #8747357 未加载
jimeh超过 10 年前
I haven&#x27;t used Flask (or Python) aside from one small hack project. It seemed simple and straight forward enough, and very similar to Ruby&#x27;s Sinatra framework. Personally in Ruby I would most likely pick Sinatra, in Python I&#x27;d pick Flash or something similar.<p>However if you wanna play with languages you&#x27;re less familiar with, I&#x27;d recommend Go, or Node.js.<p>Personally I find Go really interesting as it&#x27;s quite different from the languages I normally work in, and it&#x27;s concurrency model makes it performant without being a mindfuck.<p>Node.js is interesting as it&#x27;s Javascript, but extremely I&#x2F;O performant due to it&#x27;s evented nature, but that also makes concurrency a bit of a mindfuck at times.<p>Those are my suggestions at least if you&#x27;re itching to get your toes wet in some new fun languages :)
评论 #8744969 未加载
ivan_ah超过 10 年前
You probably know about django-rest-framework, which I find to be absolutely awesome. I wouldn&#x27;t look further --- sooo much batteries the API will practically write itself ;)
评论 #8744961 未加载
timbuchwaldt超过 10 年前
I would suggest node.js - it makes it really easy to not shoot yourself in the foot. The async nature allows for concurrency, something you can&#x27;t easily archieve with e.g. ruby and python. And while you are at it, try out hapi.js: <a href="http://hapijs.com/" rel="nofollow">http:&#x2F;&#x2F;hapijs.com&#x2F;</a> - my favorite tool for writing request proxies (which i do for a living :D )
评论 #8744880 未加载
mamcx超过 10 年前
Do it in Python with django rest or flask or whatever. You have experience on it.<p>When you have it nailed, try to do it in something else!<p>I have no experience with it, but what about elixir-lang.org? Everyone try GO or Node. Be more brave and be more niche!<p>Also, I&#x27;m learning a bit of F#. Is so crazy, and is .NET. So, how about be against the trends :)
brogrammer90超过 10 年前
If you&#x27;re just using HTTP auth then try Sinatra. You could probably whip up something viable in 50 lines.
评论 #8744749 未加载
Mithaldu超过 10 年前
If you feel like having a look at Perl, give this a try: <a href="https://metacpan.org/pod/Web::Simple" rel="nofollow">https:&#x2F;&#x2F;metacpan.org&#x2F;pod&#x2F;Web::Simple</a><p>If nothing else you&#x27;ll be introduced to a lot of programming concepts you&#x27;d otherwise be unlikely to see.
cmrajan超过 10 年前
I&#x27;d recommend Flask-Restful <a href="https://github.com/twilio/flask-restful" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;twilio&#x2F;flask-restful</a> I&#x27;ve recently used in an API project involving Elasticsearch.
meson10超过 10 年前
If you feel like using golang. I have written this and been using this in production for quite some time <a href="https://github.com/Simversity/gottp" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Simversity&#x2F;gottp</a>
phantom_oracle超过 10 年前
Maybe this might help:<p><a href="http://python-eve.org/" rel="nofollow">http:&#x2F;&#x2F;python-eve.org&#x2F;</a><p>It is written on top of Flask and includes some batteries.<p>Could get a simple API up in 2 hours.
izolate超过 10 年前
Hands down Node.js with Restify&#x2F;Express.js. And this is coming from somebody who loves Python (Flask, Pyramid)
fit2rule超过 10 年前
Check out luvit:<p><a href="https://luvit.io/" rel="nofollow">https:&#x2F;&#x2F;luvit.io&#x2F;</a><p>Learn a little Lua along the way. Really great stuff!
mahouse超过 10 年前
Flask is the way to go.
评论 #8744804 未加载
knappador超过 10 年前
Flask.
Jahak超过 10 年前
use php
评论 #8753313 未加载
评论 #8744727 未加载