# Getting Started

Sanic Extensions is an officially supported plugin developed, and maintained by the SCO. The primary goal of this project is to add additional features to help Web API and Web application development easier.

# Features

  • Auto create HEAD, OPTIONS, and TRACE endpoints
  • CORS protection
  • Predefined, endpoint-specific response serializers
  • Argument injection into route handlers
  • OpenAPI documentation with Redoc and/or Swagger
  • Request query arguments and body input validation

# Minimum requirements

  • Python: 3.8+
  • Sanic: 21.9+

# Install

pip install sanic-ext

# Extend your application

Out of the box, Sanic Extensions will enable a bunch of features for you. The easiest way to get started is just to instantiate it with Extend.

If you look back at the Hello, world app in the Sanic Getting Started page, you will see the only additions here are the two highlighted lines.

After running your application, you should now be able to view the OpenAPI documentation and see some of the functionality in action: http://localhost:8000/docs (opens new window).



from sanic import Sanic
from sanic.response import text
from sanic_ext import Extend
app = Sanic("MyHelloWorldApp")
async def hello_world(request):
    return text("Hello, world.")
MIT Licensed
Copyright © 2018-present Sanic Community Organization

~ Made with ❤️ and ☕️ ~