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)

More routing info

If you want to read all of the routing API through the guide???? click here

If you want to read all about how to setup middleware, read this

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.10.tar.gz (25.6 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.10-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for web_express_py-0.0.10.tar.gz
Algorithm Hash digest
SHA256 7172c9ee416aeb00bfdebae2de100bad1160e1b6a4b7023d10405ebd7f2b9562
MD5 2e41153adc843b64c8a0e6fcfa809cd4
BLAKE2b-256 49c98da9e59f0afe3161c4ff34a39059f0f935b5c00bd32179a2943e67d9cfac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for web_express_py-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 080607c7e9b214f33ea5ce0dee13de67d2cdd4308ffd4c7600a78907896418fe
MD5 08f112f53349d71962fd13005a9926dd
BLAKE2b-256 b21dfc52201b6e4e8e631a845ef554c18861df689b89593d82b91f936862b78b

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