forked from bilred/aws-bootcamp-cruddur-2023
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0d4c12a
Showing
135 changed files
with
33,520 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
vscode: | ||
extensions: | ||
- 42Crunch.vscode-openapi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# FREE AWS Cloud Project Bootcamp | ||
|
||
- Application: Cruddur | ||
- Cohort: 2023-A1 | ||
|
||
This is the starting codebase that will be used in the FREE AWS Cloud Project Bootcamp 2023 | ||
|
||
![Cruddur Graphic](_docs/assets/cruddur-banner.jpg) | ||
|
||
![Cruddur Screenshot](_docs/assets/cruddur-screenshot.png) | ||
|
||
## Instructions | ||
|
||
At the start of the bootcamp you need to create a new Github Repository from this template. | ||
|
||
## Journaling Homework | ||
|
||
The `/journal` directory contains | ||
|
||
- [ ] [Week 0](journal/week0.md) | ||
- [ ] [Week 1](journal/week1.md) | ||
- [ ] [Week 2](journal/week2.md) | ||
- [ ] [Week 3](journal/week3.md) | ||
- [ ] [Week 4](journal/week4.md) | ||
- [ ] [Week 5](journal/week5.md) | ||
- [ ] [Week 6](journal/week6.md) | ||
- [ ] [Week 7](journal/week7.md) | ||
- [ ] [Week 8](journal/week8.md) | ||
- [ ] [Week 9](journal/week9.md) | ||
- [ ] [Week 10](journal/week10.md) | ||
- [ ] [Week 11](journal/week11.md) | ||
- [ ] [Week 12](journal/week12.md) | ||
- [ ] [Week 13](journal/week13.md) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
FRONTEND_URL="https://3001-${GITPOD_WORKSPACE_ID}.${GITPOD_WORKSPACE_CLUSTER_HOST}" | ||
BACKEND_URL="https://4567-${GITPOD_WORKSPACE_ID}.${GITPOD_WORKSPACE_CLUSTER_HOST}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Install python version | ||
``` | ||
pyenv install 3.10.9 | ||
``` | ||
|
||
# Set your python version | ||
``` | ||
pyenv global 3.10.9 | ||
``` | ||
|
||
# Create virual environment | ||
``` | ||
python -m venv venv | ||
``` | ||
|
||
# Activate environment | ||
``` | ||
source venv/bin/activate | ||
``` | ||
|
||
# Install Flask | ||
``` | ||
pip install flask | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
from flask import Flask | ||
from flask import request | ||
from flask_cors import CORS, cross_origin | ||
import os | ||
|
||
from services.home_activities import * | ||
from services.user_activities import * | ||
from services.create_activity import * | ||
from services.create_reply import * | ||
from services.search_activities import * | ||
from services.message_groups import * | ||
from services.messages import * | ||
from services.create_message import * | ||
from services.show_activity import * | ||
|
||
app = Flask(__name__) | ||
frontend = os.getenv('FRONTEND_URL') | ||
backend = os.getenv('BACKEND_URL') | ||
origins = [frontend, backend] | ||
cors = CORS( | ||
app, | ||
resources={r"/api/*": {"origins": origins}}, | ||
expose_headers="location,link", | ||
allow_headers="content-type,if-modified-since", | ||
methods="OPTIONS,GET,HEAD,POST" | ||
) | ||
|
||
@app.route("/api/message_groups", methods=['GET']) | ||
def data_message_groups(): | ||
user_handle = 'andrewbrown' | ||
model = MessageGroups.run(user_handle=user_handle) | ||
if model['errors'] is not None: | ||
return model['errors'], 422 | ||
else: | ||
return model['data'], 200 | ||
|
||
@app.route("/api/messages/@<string:handle>", methods=['GET']) | ||
def data_messages(handle): | ||
user_sender_handle = 'andrewbrown' | ||
user_receiver_handle = request.args.get('user_reciever_handle') | ||
|
||
model = Messages.run(user_sender_handle=user_sender_handle, user_receiver_handle=user_receiver_handle) | ||
if model['errors'] is not None: | ||
return model['errors'], 422 | ||
else: | ||
return model['data'], 200 | ||
return | ||
|
||
@app.route("/api/messages", methods=['POST','OPTIONS']) | ||
@cross_origin() | ||
def data_create_message(): | ||
user_sender_handle = 'andrewbrown' | ||
user_receiver_handle = request.json['user_receiver_handle'] | ||
message = request.json['message'] | ||
|
||
model = CreateMessage.run(message=message,user_sender_handle=user_sender_handle,user_receiver_handle=user_receiver_handle) | ||
if model['errors'] is not None: | ||
return model['errors'], 422 | ||
else: | ||
return model['data'], 200 | ||
return | ||
|
||
@app.route("/api/activities/home", methods=['GET']) | ||
def data_home(): | ||
data = HomeActivities.run() | ||
return data, 200 | ||
|
||
@app.route("/api/activities/@<string:handle>", methods=['GET']) | ||
def data_handle(handle): | ||
model = UserActivities.run(handle) | ||
if model['errors'] is not None: | ||
return model['errors'], 422 | ||
else: | ||
return model['data'], 200 | ||
|
||
@app.route("/api/activities/search", methods=['GET']) | ||
def data_search(): | ||
term = request.args.get('term') | ||
model = SearchActivities.run(term) | ||
if model['errors'] is not None: | ||
return model['errors'], 422 | ||
else: | ||
return model['data'], 200 | ||
return | ||
|
||
@app.route("/api/activities", methods=['POST','OPTIONS']) | ||
@cross_origin() | ||
def data_activities(): | ||
user_handle = 'andrewbrown' | ||
message = request.json['message'] | ||
ttl = request.json['ttl'] | ||
model = CreateActivity.run(message, user_handle, ttl) | ||
if model['errors'] is not None: | ||
return model['errors'], 422 | ||
else: | ||
return model['data'], 200 | ||
return | ||
|
||
@app.route("/api/activities/<string:activity_uuid>", methods=['GET']) | ||
def data_show_activity(activity_uuid): | ||
data = ShowActivity.run(activity_uuid=activity_uuid) | ||
return data, 200 | ||
|
||
@app.route("/api/activities/<string:activity_uuid>/reply", methods=['POST','OPTIONS']) | ||
@cross_origin() | ||
def data_activities_reply(activity_uuid): | ||
user_handle = 'andrewbrown' | ||
message = request.json['message'] | ||
model = CreateReply.run(message, user_handle, activity_uuid) | ||
if model['errors'] is not None: | ||
return model['errors'], 422 | ||
else: | ||
return model['data'], 200 | ||
return | ||
|
||
if __name__ == "__main__": | ||
app.run(debug=True) |
Oops, something went wrong.