REST APIs with Flask

Alok K. Shukla

When you work with Data, chances are Python is your go-to language but if you are also a Software Designer like me, you might already have your choice of dev stack for Production Environment. And in my case it is Java and I've spent years building scalable tools and APIs with it. So when I was tasked with building a backend system for an iOS app; where I was also building something like a Recommendation Engine for the app ( with Python ); I faced a dilemma; whether to use Java for my backend or try something new and build with Flask; though working with Flask would give me easy integration with my models built with Python, there was another aspect - how much of an investment would be learning another Framework. Somehow the curios that I am, I gave up my comfy Java and chose Flask, without even looking at the effort for Hello! World.

And, to my pleasant surprise, this was one of the good decisions I made in recent past. Here's how Hello! World with Flask looks like

from flask import Flask  
hello = Flask(__name__)  
@hello.route("/")
def home():  
    return "Hello, world!"
hello.run(port=5000)  

Could it be simpler?

FWIW, I learnt with Udemy; its a wonderful class and within a couple of hours I had chops for a full fledged REST backend with authentication and a connected DB.

SO, if you're wondering whether you should use Flask or not? Try for yourself, I can promise it'd be least demanding web framework you ever worked with. And if you're someone who's just getting started; forget everything else and learn Flask.

Reference

http://flask.pocoo.org/