Skip to content

Commit

Permalink
feat: add run-web-api.sh to easy launch dev mode API server (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
joanise authored Oct 21, 2024
1 parent eec5662 commit 36b8b0d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
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

0 comments on commit 36b8b0d

Please sign in to comment.