Skip to main content

A concise and lightweight web framework.✨

Project description

![freesia](./images/logo.png)

## Introduction
Freesia is a concise and lightweight async web framework. Its api is inspired by Flask.

## Installation
```bash
pip install async-freesia
```

## Docs
You can find the project's detailed API documentation on [here](https://freesia.readthedocs.io/en/latest/?).

## Example
*hello world*
```python
from freesia import Freesia

app = Freesia()

@app.route('/hello/<name>')
async def hello(request, name):
return "Hello, " + name + "!"

if __name__ == "__main__":
app.run()
```

*middleware*
```python
from freesia import Freesia

app = Freesia()

@app.route("/<name>")
async def hello(request, name):
print("enter user handler")
return "hello, " + name


async def middleware1(request, handler):
print("enter middleware1")
res = await handler()
print("exit middleware1")
return res + " !"


async def middleware2(request, handler):
print("enter middleware2")
res = await handler()
print("exit middleware2")
return res + " :D"


app.use([middleware1, middleware2])

if __name__ == "__main__":
app.run()
```

*session*
```python
from freesia import Freesia, set_up_session, get_session, Response
from freesia.session import SimpleCookieSession

app = Freesia()

@app.route("/")
async def hello(request):
s = await get_session(request)
if "count" not in s:
s["count"] = 1
return Response(text="Hello, stranger!")
else:
s["count"] += 1
return Response(text="I've seen you %d times" % s["count"])

if __name__ == "__main__":
set_up_session(app, SimpleCookieSession)
app.run()
```

## More
You can see more exmaple and usags in [docs](https://freesia.readthedocs.io/en/latest/?) and [examples](./examples).

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

async_freesia-0.1.2.tar.gz (18.8 kB view details)

Uploaded Source

File details

Details for the file async_freesia-0.1.2.tar.gz.

File metadata

  • Download URL: async_freesia-0.1.2.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.7

File hashes

Hashes for async_freesia-0.1.2.tar.gz
Algorithm Hash digest
SHA256 7808fe613cce06d0a9892bb9996977f1a3af186c783f877601c9e05485aaf0a7
MD5 7fab578c46a27bf5294b30ae93f08725
BLAKE2b-256 567a559b67642daed474a5ecdca2828c872c126f5b57aab25a106c072bcba3fb

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