Skip to content

Commit

Permalink
Merge pull request #9 from uclahs-cds/aholmes-polish-web-and-db
Browse files Browse the repository at this point in the history
Add additional output to `bl-python-scaffold`
  • Loading branch information
aholmes authored Sep 20, 2023
2 parents 4bfec99 + 5020745 commit 444aa4e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/web/BL_Python/web/scaffolding/scaffolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
@dataclass
class ScaffoldEndpoint:
endpoint_name: str
# This is Flask's default hostname.
hostname: str = "http://127.0.0.1:5000"


@dataclass
Expand Down Expand Up @@ -167,6 +169,10 @@ def _scaffold_endpoints(
template.name, template_string_config
)

self._log.info(
f"\"{endpoint['endpoint_name']}\" will be accessible at {endpoint['hostname']}/{endpoint['endpoint_name']}"
)

# make the current endpoint configuration available
# in a top-level `endpoint` variable
template_config = self._config_dict.copy()
Expand Down
2 changes: 2 additions & 0 deletions src/web/BL_Python/web/scaffolding/templates/base/README.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
3. Install dependencies `pip install .`
4. Run the application `python {{application_name}}`

You can now access your endpoints in your browser, or with `curl`.

## Adding API endpoints

There are two ways to create an API with `BL_Python.web`: with Flask Blueprints, and with an OpenAPI spec. If you did not specify a type when using the scaffolder, or you specified "basic," then your application uses Blueprints.
Expand Down

0 comments on commit 444aa4e

Please sign in to comment.