Skip to main content

An HTTP server framework

Project description

Slinn

Slinn is an HTTP server framework
License GitHub top language
GitHub Release GitHub repo size GitHub Repo stars

Simple 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 example on Windows and venv/bin/python manage.py template example on 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


Download files

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

Source Distribution

slinn-2.3.4b0.tar.gz (6.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slinn-2.3.4b0-py3-none-any.whl (22.5 MB view details)

Uploaded Python 3

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

Hashes for slinn-2.3.4b0.tar.gz
Algorithm Hash digest
SHA256 2a5e3712d865d6b84d097834b368f167824172dfdd2ee8daefdcf1a8390a8562
MD5 4fea521b864a45e7006f7205b2a00356
BLAKE2b-256 5ccc1ad71ddc1eca923b5732fc9f433839219aa33bf97818913a0f01675e2184

See more details on using hashes here.

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

Hashes for slinn-2.3.4b0-py3-none-any.whl
Algorithm Hash digest
SHA256 bfb512543b2fcaeed2e7a736dcae7ee2f030df8c1662e646b4745db0dee13506
MD5 923c18551643a37eedda1bee0c46ec60
BLAKE2b-256 e1d16fee17ee24487a1066f6ec6fffaab67ad55206f6c4acf693fce6dd85122e

See more details on using hashes here.

Supported by

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