Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hug-middleware-cors

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hug-middleware-cors

CORS middleware for the hug framework

  • 1.0.0
  • PyPI
  • Socket score

Maintainers
1

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__)
api.http.add_middleware(CORSMiddleware(api))

@hug.post('/demo')
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 server.py
  3. Start a static http server on port 8080 using python -m http.server 8080
  4. Go to http://localhost:8080 to send a preflighted CORS request to the hug server.

License

MIT License

See LICENSE for details

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc