Skip to main content

CORS middleware for the hug framework

Project description

# hug CORS middleware

A [hug]( middleware for allowing CORS (cross-origin resource sharing) requests from hug servers.

## Installation

pip install hug_middleware_cors

## Usage

import hug
from hug_middleware_cors import CORSMiddleware

api = hug.API(__name__)
def demo(name: 'your name'):
return {"result": "Hello {0}".format(name)}

## Demoing

1. Check out this repository and navigate to its root
2. Start a hug server on port 8000 using: `hug -f`
3. Start a static http server on port 8080 using `python -m http.server 8080`
4. Go to [http://localhost:8080](http://localhost:8080) to send a preflighted CORS request to the hug server.

## License
MIT License

See LICENSE for details

Project details

Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for hug-middleware-cors, version 1.0.0
Filename, size & hash File type Python version Upload date
hug_middleware_cors-1.0.0-py3-none-any.whl (4.1 kB) View hashes Wheel py3
hug_middleware_cors-1.0.0.tar.gz (2.3 kB) View hashes Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page