Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add run-web-api.sh to easy launch dev mode API server #248

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ For information on spinning up your own dev Web API server locally, have a look

DEVELOPMENT=1 uvicorn readalongs.web_api:web_api_app --reload

or

./run-web-api.sh

Note that the production command line for the Web API is defined in [Procfile](Procfile) and documented in [web\_api.py](readalongs/web_api.py).

#### /langs

To query a list of available languages in the ReadAlong Studio API, send a GET request to https://readalongs-studio.herokuapp.com/api/v1/langs
Expand Down
18 changes: 18 additions & 0 deletions run-web-api.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# Convenience script to launch the Web API in development mode.
# Do not use in production! (See ../Procfile for the prod launch command.)
#
# Usage:
# pip install uvicorn
# /path/to/run-web-api.sh
#
# Further documentation is in readalongs/web_api.py

# Move to the code root directory, so that --reload works correctly.
CODE_ROOT_PATH=$(dirname $(realpath $0))/readalongs
cd $CODE_ROOT_PATH

# Launch the Web API with the --reload option, which will automatically reload
# the server whenver the code changes.
DEVELOPMENT=1 uvicorn readalongs.web_api:web_api_app --reload
Loading