Creating a REST API is one of the building block of lot of software. It lets us access to data using an easy protocol accessible by most of the recent programming languages. That’s great but which language should we use to build the API.

As a developer I built multiple REST API and as most people that finished their studies before 2000, the classic way to do that, was to use one of the two most used frameworks:

  • ASP.Net
  • Java

These two stacks are definitively good choices for REST APIs. For the ASP.Net, using the MVC framework and Swagger gives good results.

For the java stack, Spring and the springfox implementation of swagger do the trick. Using that, you can remove the hassle of the deployment on an application server.

From my point of these two technologies give similar results, have strong communities and follow the same logic. (Controllers, Model, annotations, e.t.c) Setting up the projects and running them could be tricky but thanks to their communities there are a lot of demo codes on the web.

Testing NodeJS

NodeJS is a nice framework that gives quick results. By using express (npm install express) a simple REST API could be as short as that:

var express = require('express');
 var app = express();

app.get('/api/v1/status', function (req, res) {
 res.end( JSON.stringify({status:"ok",version:1}) );

var server = app.listen(8765, function () {
 console.log("Example app listening at http://%s:%s", server.address().address, server.address().port)


Url: http://localhost:8765/api/v1/status

This is quite compact and easily set up compared to ASP.Net or Java.

Testing Python

Flask gives python everything required to build such an API.

from flask import Flask
from flask import jsonify
from flask import request

app = Flask(__name__)

def status():
    return jsonify({'status':'ok','version':'1'})

Url: http://localhost:5000/api/v1/status

That’s comparable in term of number lines to node.js. I like the annotation that limits the parenthesis nightmare that node.js create. (Remember that node.js is a non blocking mono threaded framework and that the only way to create synchronous code is by using the promises pattern that can lead to tricky code).

There is a Python Flask/Swagger framework which really helps setting up swagger in the python environment.


There is no clear winner on this. For me small projects should use node.js or python because it is very easy to setup, develop and deploy. Node.js can be tricky if the developers do not follow some syntaxes standard. So my preference would probably go for python. On the other hand, big projects require heavy normalisations which frameworks like ASP.Net or Java give. So once again, no silver bullet. The answer depends on the skills of the IT developers. (In term of complexity [dev / setup /maintenance] , I would sort the frameworks in this order: Python+Flask easier than node.js+Express easier than APS.NET+MVC easier than Java+Spring) Note that I do not take the performance into account which is in most cases not a real issue except if your API is available to everyone from the internet.