Skip to content

Python quart server + esbuild application base, with websockets/sse streaming from quart (with bonus multithreading example in quart)

License

Notifications You must be signed in to change notification settings

joshbrew/esbuild_base_python

Repository files navigation

Minimal esbuild, Nodejs, and Python Quart concurrent test env.

Requires: Python 3.7 or later and NodeJS LTS or later

image

This test runs a websocket and a thread on the python quart server. You can access the Node-served test page at http://localhost:8000 or the quart server test page at http://localhost:7000 to experiment (add /build at port 7000 to access the node build (minus hot reload)).

Quart enables fast asyncio server streams from python. Bonus thread-generated data in python streaming through websockets to show off the potential.

npm run pip should install any missing python packages. See README)

npm run dev installs nodejs packages and runs both python and node servers concurrently (with hot reloading for FE with a persistent python streaming server backend).

After installing dependencies,

Run Python and Node together:

npm run concurrent

Otherwise

To run: npm run build to bundle, then npm start to run the node server.

  • OR npm test to run both commands in sequence

You can specify https and add an ssl certificate if you follow the instructions.

2 dependencies: esbuild and fragelement

Hot reloading (for dev)

npm run dev

then npm run startdev

nodemon restarts the node server automatically when changes to included source files are detected.

The nodemon dev server adds basic frontend hot reloading via websocket and clientside code injection (see nodeserver/server.js for method).

2 dev dependencies: nodemon and ws

PWA build:

To test:

npm run pwa

This installs workbox-cli, generates the service worker, bundles and then starts the application. Run once if you don't need to modify the service-worker further.

1 additional dependency: workbox-cli

Other notes:

See README.md files in each folder for more explanation on how to work with these types of applications.

About

Python quart server + esbuild application base, with websockets/sse streaming from quart (with bonus multithreading example in quart)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published