Skip to main content

Webserver written as express.js

Project description

express.py

Python implementation of the widely used express.js

Why

Going to answer this first: because yes. More out of boredom and wanting to do something with my time rather than playing games. But oh well, here it is.

Installation

Install this package with a very very very very very simple command:

# Unix / macOS:
python3 -m pip install --upgrade web-express-py

# Windows:
py -3 -m pip install --upgrade web-express-py

After this, you can just import express into any of your projects using:

from express import express

Ok here comes stealing examples from express.js

Hello world example

from express import express

app = express()

@app.get("/")
def helloWorld(req, res):
    res.send("Hello World!")

app.listen(3000)

Basic routing

from express import express

app = express()

@app.get("/")
def helloWorld(req, res):
    res.send("Hello World!")

@app.post("/")
def aPostRequest(req, res):
    res.send("Got a POST request")

@app.put("/user")
def updateUser(req, res):
    res.send("Got a PUT request at /user")

def deleteUser(req, res):
    res.send("Got a DELETE request at /user")
app.delete("/user", deleteUser)

app.listen(3000)

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

web_express_py-0.0.2.tar.gz (24.3 kB view details)

Uploaded Source

Built Distribution

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

web_express_py-0.0.2-py3-none-any.whl (24.6 kB view details)

Uploaded Python 3

File details

Details for the file web_express_py-0.0.2.tar.gz.

File metadata

  • Download URL: web_express_py-0.0.2.tar.gz
  • Upload date:
  • Size: 24.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for web_express_py-0.0.2.tar.gz
Algorithm Hash digest
SHA256 ee7b07ef4b5410b4241ae4e31b653d7773ba1c4d9318f6c6bde678fcf3884727
MD5 cb967918834ed30b871767d4016395c3
BLAKE2b-256 8ef86fc36f49bfd474c102adf37c10f844e45dee6eda880c7f04664686148bac

See more details on using hashes here.

File details

Details for the file web_express_py-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: web_express_py-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 24.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for web_express_py-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1541039f3309e933e33bb7213b73a2f23d1d5a74af46fb513eb7762ad9c666a4
MD5 9f3ae0c7d78ed73576d90d181f732ace
BLAKE2b-256 dda5e3307f67b6f93691955ffd99966d4fc35993ba151b069df6c65a39ce85c7

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