Skip to content

Commit

Permalink
Merge pull request #20 from israelias/backend
Browse files Browse the repository at this point in the history
Backend documentation and workspace disclaimers
  • Loading branch information
israelias authored Aug 29, 2021
2 parents 47d66e5 + f176aa8 commit a138729
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
3 changes: 2 additions & 1 deletion backend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
__pycache__
__pycache__
node_modules/
34 changes: 32 additions & 2 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

The restful API is deployed at [cheathub-backend.herokuapp.com/](https://cheathub-backend.herokuapp.com/)

> *Note:* Open API spec is forthcoming. Please see `database/models.py` to preview the snippet, collection and user document models.
## Heroku Deployment
```bash
#create new git repository and add everything
Expand Down Expand Up @@ -47,9 +49,9 @@ In this half of the monorepo, you can run:

Serves the Databse backend.\
Runs the backend app in the development mode.\
Open [http://localhost:5000/admin](http://localhost:5000/admin) to view the admin panel in the browser.
Open [http://localhost:5000/admin](http://localhost:5000/admin) to view the admin panel in the browser (ensure `BASIC_AUTH` variables are set).

Open [http://localhost:5000/api/snippets](http://localhost:5000/api/snippets) to view the JSON response format of all public snippets.
Open [http://localhost:5000/api/snippets](http://localhost:5000/api/snippets) to view the JSON response format of all public snippets -- assuming `snippet` objects have been created. Otherwise, use Postman to create documents locally (API spec is forthcoming!).

The page will reload if you make edits.\
You will also see any errors in the console.
Expand Down Expand Up @@ -103,6 +105,33 @@ Set the variable to this key:
# env.py
os.environ.setdefault("JWT_SECRET_KEY", "<your JWT secret key>")
```
### `BASIC_AUTH_USERNAME`

Superuser username to access admin panel at `/admin`

Set the variable to this key:
```python
# env.py
os.environ.setdefault("BASIC_AUTH_USERNAME", "<your superuser username>")
```

### `BASIC_AUTH_PASSWORD`

Superuser password to access admin panel at `/admin`

Set the variable to this key:
```python
# env.py
os.environ.setdefault("BASIC_AUTH_USERNAME", "<your superuser password>")
```
### Flask Mail Option
> See [Flask Mail](https://pythonhosted.org/Flask-Mail/)
Similarly, apply the same logic to:
- `MAIL_SERVER`
- `MAIL_PORT`
- `MAIL_USERNAME`
- `MAIL_PASSWORD`
- `MAIL_DEFAULT_SENDER`

## Database Server

Expand Down Expand Up @@ -139,6 +168,7 @@ You can add documents via Postman or Mongo Compass.
- [Flask Admin](https://flask-admin.readthedocs.io/en/latest/)
- [Flask Session](https://flask-session.readthedocs.io/en/latest/)
- [Flask Restful](https://flask-restful.readthedocs.io/en/latest/)
- [Flask Mail](https://pythonhosted.org/Flask-Mail/)

## Resources
- [Heroku Deployment](https://stackoverflow.com/questions/7539382/how-can-i-deploy-push-only-a-subdirectory-of-my-git-repo-to-heroku)
Expand Down

1 comment on commit a138729

@vercel
Copy link

@vercel vercel bot commented on a138729 Aug 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.