Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 72 for middleware (0.07 sec)

  1. docs_src/advanced_middleware/tutorial003.py

    from fastapi import FastAPI
    from fastapi.middleware.gzip import GZipMiddleware
    
    app = FastAPI()
    
    app.add_middleware(GZipMiddleware, minimum_size=1000, compresslevel=5)
    
    
    @app.get("/")
    async def main():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Aug 15 22:38:02 UTC 2024
    - 230 bytes
    - Viewed (0)
  2. docs_src/advanced_middleware/tutorial002.py

    from fastapi import FastAPI
    from fastapi.middleware.trustedhost import TrustedHostMiddleware
    
    app = FastAPI()
    
    app.add_middleware(
        TrustedHostMiddleware, allowed_hosts=["example.com", "*.example.com"]
    )
    
    
    @app.get("/")
    async def main():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Mar 26 19:09:53 UTC 2020
    - 279 bytes
    - Viewed (0)
  3. cmd/api-router.go

    		// Wrap the actual handler with the appropriate tracing middleware.
    		var tracedHandler http.HandlerFunc
    		if handlerFlags.has(traceHdrsS3HFlag) {
    			tracedHandler = httpTraceHdrs(f)
    		} else {
    			tracedHandler = httpTraceAll(f)
    		}
    
    		// Skip wrapping with the gzip middleware if specified.
    		var gzippedHandler http.HandlerFunc = tracedHandler
    		if !handlerFlags.has(noGZS3HFlag) {
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Tue Aug 13 15:25:16 UTC 2024
    - 23.1K bytes
    - Viewed (0)
  4. docs/tr/docs/advanced/wsgi.md

    ## `WSGIMiddleware` Kullanımı
    
    `WSGIMiddleware`'ı projenize dahil edin.
    
    Ardından WSGI (örneğin Flask) uygulamanızı middleware ile sarmalayın.
    
    Son olarak da bir yol altında bağlama işlemini gerçekleştirin.
    
    ```Python hl_lines="2-3  23"
    {!../../docs_src/wsgi/tutorial001.py!}
    ```
    
    ## Kontrol Edelim
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 1.3K bytes
    - Viewed (0)
  5. docs_src/cors/tutorial001.py

    from fastapi import FastAPI
    from fastapi.middleware.cors import CORSMiddleware
    
    app = FastAPI()
    
    origins = [
        "http://localhost.tiangolo.com",
        "https://localhost.tiangolo.com",
        "http://localhost",
        "http://localhost:8080",
    ]
    
    app.add_middleware(
        CORSMiddleware,
        allow_origins=origins,
        allow_credentials=True,
        allow_methods=["*"],
        allow_headers=["*"],
    )
    
    
    @app.get("/")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Mar 26 19:09:53 UTC 2020
    - 459 bytes
    - Viewed (0)
  6. docs/en/docs/advanced/wsgi.md

    ## Using `WSGIMiddleware`
    
    You need to import `WSGIMiddleware`.
    
    Then wrap the WSGI (e.g. Flask) app with the middleware.
    
    And then mount that under a path.
    
    ```Python hl_lines="2-3  23"
    {!../../docs_src/wsgi/tutorial001.py!}
    ```
    
    ## Check it
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 1.1K bytes
    - Viewed (0)
  7. docs_src/wsgi/tutorial001.py

    from fastapi import FastAPI
    from fastapi.middleware.wsgi import WSGIMiddleware
    from flask import Flask, request
    from markupsafe import escape
    
    flask_app = Flask(__name__)
    
    
    @flask_app.route("/")
    def flask_main():
        name = request.args.get("name", "World")
        return f"Hello, {escape(name)} from Flask!"
    
    
    app = FastAPI()
    
    
    @app.get("/v2")
    def read_main():
        return {"message": "Hello World"}
    
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue May 09 14:32:00 UTC 2023
    - 443 bytes
    - Viewed (0)
  8. docs/de/docs/advanced/wsgi.md

    ## `WSGIMiddleware` verwenden
    
    Sie müssen `WSGIMiddleware` importieren.
    
    Wrappen Sie dann die WSGI-Anwendung (z. B. Flask) mit der Middleware.
    
    Und dann mounten Sie das auf einem Pfad.
    
    ```Python hl_lines="2-3  23"
    {!../../docs_src/wsgi/tutorial001.py!}
    ```
    
    ## Es ansehen
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 1.2K bytes
    - Viewed (0)
  9. docs/pt/docs/advanced/wsgi.md

    ## Usando o `WSGIMiddleware`
    
    Você precisa importar o `WSGIMiddleware`.
    
    Em seguinda, encapsular a aplicação WSGI (e.g. Flask) com o middleware.
    
    E então **"montar"** em um caminho de rota.
    
    ```Python hl_lines="2-3  23"
    {!../../docs_src/wsgi/tutorial001.py!}
    ```
    
    ## Conferindo
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 1.2K bytes
    - Viewed (0)
  10. fastapi/middleware/httpsredirect.py

    from starlette.middleware.httpsredirect import (  # noqa
        HTTPSRedirectMiddleware as HTTPSRedirectMiddleware,
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Dec 20 18:50:00 UTC 2020
    - 115 bytes
    - Viewed (0)
Back to top