Skip to main content

Dead simple restful wsgi applications

Project description

# dsrw
Dead simple restful wsgi applications

# Installation

```pip install dsrw```

# Usage

```python
from wsgiref.simple_server import make_server
from dsrw import App, Request

app = App()
api = app.ns('/api')

@app.get('/hello')
def hello(req: Request):
return {'msg': "Hello world!"}


@app.get('/hello/:name')
def other(req: Request):
return {'msg': 'Hello',
'name': req.param.name}


@api.get('/echo')
def echo(req: Request):
if req.has_valid_body:
return req.body
else:
return ["No body available"]


if __name__ == '__main__':
httpd = make_server('', 8080, app)
print("Serving HTTP on port 8080...")

# Respond to requests until process is killed
httpd.serve_forever()

```

# Todo
- Middleware


Project details


Download files

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

Source Distribution

dsrw-0.1.4.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

dsrw-0.1.4-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file dsrw-0.1.4.tar.gz.

File metadata

  • Download URL: dsrw-0.1.4.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for dsrw-0.1.4.tar.gz
Algorithm Hash digest
SHA256 4c0ef48228cd4c9d0dd216a3bbc75220d8bf9e4bd49c9e1b518bf3b2049e6ce3
MD5 600dfa614f383d6046ea7c8a273672a5
BLAKE2b-256 cd55ba0c3ffd8de6c21f6fb14bd2e86d427ff35e55c71a9b503fcbbc5068fab8

See more details on using hashes here.

File details

Details for the file dsrw-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for dsrw-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dadba88f96ef0bee469083e8acf4119cc916c6562b3473920f4e33149449af04
MD5 3a13f62fbd4aace376de3db696766c22
BLAKE2b-256 419d4d94c274c5962e91a882d64bc4d6ef3f05640603d575241e5500d84f9c5c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page