FastAPI

FastAPI: How to Return a TXT or JSON File

This concise, practical article shows you how to return a TXT or a JSON file in FastAPI. I assume you already have some understanding of the web framework,…

FastAPI: How to extract request headers (2 approaches)

This concise, practical article will walk you through a couple of different ways to extract headers from an incoming request in FastAPI. What are HTTP headers? Headers are…

3 Ways to Get User’s IP Address in FastAPI

When building backend applications with FastAPI, you may need to get the IP addresses of your users for several purposes, such as: This quick article shows you a…

How to Return a CSV File in FastAPI

CSV stands for Comma Separated Values. It is a plain text file that stores data by delimiting data entries with commas. CSV files are popular in Python apps…

FastAPI: How to Upload and Validate Files

This concise, straightforward article shows you how to upload and validate files in a FastAPI application. Uploading Files The Steps To receive and handle files as well as…

FastAPI: Allowing Requests from Other Origins (CORS)

Introduction By default, a FastAPI application does not allow requests from different origins than its own domain. Allowing requests from different origins in FastAPI is a common scenario…

Serving Static Files in FastAPI: Tutorial & Example

This tutorial shows you how to serve static files (images, CSS files, Javascript files, HTML files, or something like that) in FastAPI. Before getting started, you can see…

How to Create an XML Sitemap in FastAPI

This article walks you through a step-by-step guide to generating an XML Sitemap with FastAPI. Without any further ado, let’s get started. What is an XML Sitemap? An…

Deploying FastAPI on Ubuntu with Nginx and Let’s Encrypt

FastAPI is a modern, fast, and high-performance web framework for building APIs and web applications. After coding and developing a FastAPI application on your personal computer, you will…

FastAPI: How to Disable the Docs (Swagger UI and ReDoc)

FastAPI is an open-source, lightweight, high-performance, and secure web framework for building backend APIs. Despite its young age, FastAPI has been well received by the community and in…

1 2 3