Live data from Hacker News

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

news.ycombinator.com

21–30 of 30 posts

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

#21
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 (http://www.gorillatoolkit.org). It's a toolkit and not a framework, so you can just use the parts that you need, and that's nice way of staying "lightweight."

With that said, I wouldn't brush off Python as a possible choice. Here are some small/lightweight Python web frameworks in addition to Flask (http://flask.pocoo.org):

1. Bottle (http://bottlepy.org). It's a one file module and has no dependencies.

2. Web.py (http://webpy.org). The "anti-framework." Very simple.

3. CherryPy (http://www.cherrypy.org). Another minimal framework that comes with its own WSGI server.

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't ignore it). If you do use Django, then you can also use Haystack (http://haystacksearch.org) to easily work with Elasticsearch.

It's hard to give detailed suggestions without knowing the application you are trying to build, but I hope you find this helpful.

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

#22

You probably know about django-rest-framework, which I find to be absolutely awesome. I wouldn't look further --- sooo much batteries the API will practically write itself ;)

I'm familiar with DRF, and yes, it is terrific. However, because I want to interface directly with Elasticsearch, I am inclined to drop Django altogether.

I see. Then node might be a good tech to look into. It's very good for network stuff. Here is an example of a `solr` proxy written by my friend: https://github.com/dergachev/solr-security-proxy/blob/master...

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

#23
Do it in Python with django rest or flask or whatever. You have experience on it.

When you have it nailed, try to do it in something else!

I have no experience with it, but what about elixir-lang.org? Everyone try GO or Node. Be more brave and be more niche!

Also, I'm learning a bit of F#. Is so crazy, and is .NET. So, how about be against the trends :)

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

#24
post #9

I haven't used Flask (or Python) aside from one small hack project. It seemed simple and straight forward enough, and very similar to Ruby's Sinatra framework. Personally in Ruby I would most likely pick Sinatra, in Python I'd pick Flash or something similar. However if you wanna play with languages you're less familiar with, I'd recommend Go, or Node.js. Personally I find Go really interesting as it's quite differen…

I actually went through the Golang quickstart before writing my original post. It is very tempting, but I'm concerned it might be a long journey for what should be a simple app. In your experience, how productive is Go at kicking out basic CRUD APIs?

I haven't built a full CRUD app myself, mostly some small hacked together tools and various silly stuff. Personally though I did end up just experimenting with basic stuff to get familiar with the language and tools for a couple of evenings before I got anything even half-useful done.

So I'd say, if just want to get a simple CRUD API app out quickly, use Python and Flask or something similar as it's something you already know well. If you wanna use the CRUD API app as an excuse to play with new languages and technologies which will hopefully lead to a expanded skill-set, then go for Go ;)

As for Node.js, if you already know Javascript, it'll fall about 30-40% of the way between using Python that you know and Go that you don't know.

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

#27

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 ( http://www.gorillatoolkit.org ). It's a toolkit and not a framework, so you can just use the parts that you need, and that's nice way of staying "lightweight." With that said, I wouldn't brush off Python as a possible choice. Here are some small/lightweig…

Thanks for the answer, and thanks for the links. I gave DRF+Haystack serious consideration already—in fact, I built a prototype using these packages. The reason I do not want to move forward with them is that they make the assumption that you will be using Django's ORM and some sort of SQL store for persistence with Elasticsearch bolted on top. My intention is to use Elasticsearch exclusively. I also want to use the API with Ember.js, which is difficult given the differing JSON format opinions between DRF and Ember.js (see ember-django-adapter[1]).

I've also noticed that Haystack's owner has been inactive recently which concerns me. This in itself gave me a reason to check out Elasticsearch's own Python bindings[2] which aren't that scary after all.

I am looking at Gorilla web toolkit (thanks for the link!).

[1]: https://github.com/dustinfarris/ember-django-adapter

[2]: https://github.com/elasticsearch/elasticsearch-py

Post reply on HN