Barebone Serverless Flask REST API on Zeit Now
Learn how to set up a barebone JSON REST API in Flask and deploy it to Zeit Now
In this post we’ll set up a Flask app serving as a starting point for building a REST API. If you know some Python, you will be able to go through the steps below to successfully set up the API on your own. Note: I’m using Python 3.6.3.
The full source code can be found on Github: https://github.com/visini/barebone-serverless-flask-api-zeit-now
What we’ll use:
- Python 3 and PyCharm as an IDE
- Zeit Now, a serverless platform
- Flask, a popular Python micro framework for the web
- Flask-RESTPlus, a Flask extension for building REST APIs
- PostgreSQL as a database (hosted remotely on AWS RDS)
- Psycopg2, the most popular PostgreSQL adapter for Python
The end result is a fully working Flask-powered REST API serving as a starting point for your project (for example, a microservice). As it is hosted on Zeit Now, you’ll be able to deploy it without having to provision any servers.
Updated full version of this article:
Please view the updated version of this article (including full source code + syntax highlighting of all code snippets) on my website:
Thanks for reading!
Originally published on camillovisini.com.