An HTTP server framework
Project description
Slinn
Slinn is an HTTP server frameworkSimple example
from slinn import ApiDispatcher, AnyFilter, HttpResponse, HttpRedirect, HttpJSONResponse
dp = ApiDispatcher()
@dp.get('api')
async def api(request):
return HttpJSONResponse(status='ok')
@dp.get()
@dp.get('index')
async def index(request):
return HttpRedirect('/helloworld')
@dp(AnyFilter)
async def helloworld(request):
return HttpResponse('Hello world!')
Begin project
Standart
python3 -m slinn create helloworld
cd helloworld
venv/bin/python manage.py create localhost host=localhost host=127.0.0.1
venv/bin/python manage.py run
Insert example into localhost/app.py file
[!TIP] Instead of use example, create app from template
py manage.py template exampleon Windows andvenv/bin/python manage.py template exampleon Unix-like OSes
Expected output
helloworld $ venv/bin/python manage.py run
Loading config...
Apps: firstrun
Debug mode enabled
Smart navigation enabled
Starting server...
HTTP server is available on http://localhost:8080/
To config project you should edit ./project.json
To config app you should edit ./%app%/config.json
Classic
Unix-like (Linux, MacOS, FreeBSD...):
mkdir helloworld
cd helloworld
python3 -m venv venv
venv/bin/activate
Windows:
mkdir helloworld
cd helloworld
python3 -m venv venv
venv\Scripts\activate
Insert example into ./example.py and add following code:
from slinn import AsyncServer
import asyncio
asyncio.run(AsyncServer(dp).listen(Address(8080)))
then write python example.py
Excepted output
helloworld $ venv/bin/python example.py
HTTP server is available on http://localhost:8080/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file slinn-2.3.4b0.tar.gz.
File metadata
- Download URL: slinn-2.3.4b0.tar.gz
- Upload date:
- Size: 6.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.3 CPython/3.12.2 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a5e3712d865d6b84d097834b368f167824172dfdd2ee8daefdcf1a8390a8562
|
|
| MD5 |
4fea521b864a45e7006f7205b2a00356
|
|
| BLAKE2b-256 |
5ccc1ad71ddc1eca923b5732fc9f433839219aa33bf97818913a0f01675e2184
|
File details
Details for the file slinn-2.3.4b0-py3-none-any.whl.
File metadata
- Download URL: slinn-2.3.4b0-py3-none-any.whl
- Upload date:
- Size: 22.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.3 CPython/3.12.2 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfb512543b2fcaeed2e7a736dcae7ee2f030df8c1662e646b4745db0dee13506
|
|
| MD5 |
923c18551643a37eedda1bee0c46ec60
|
|
| BLAKE2b-256 |
e1d16fee17ee24487a1066f6ec6fffaab67ad55206f6c4acf693fce6dd85122e
|