Commit ae73ab68 by Trevor Austin

Add example of template processing (not used in assignment)

parent e26295c1
......@@ -10,7 +10,7 @@ app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0
# sample_chats = {
# 1: {
# "authorized_users": {
# "session_token_0": {"username": "Alice", "expires": "2020-02-15T20:53:15Z"},
# "as3215jhkg231hjgkl4123": {"username": "Alice", "expires": "2020-02-15T20:53:15Z"},
# "session_token_1": {"username": "Bob", "expires": "2020-02-15T20:57:22Z"}
# },
# "magic_key": "some_really_long_key_value"
......@@ -52,6 +52,14 @@ def auth():
def chat():
return app.send_static_file('chat.html')
@app.route('/exampleTemplate')
def example():
return render_template('exampleTemplate.html',
title="My Cool Title!",
header="My cool header!")
# -------------------------------- API ROUTES ----------------------------------
......@@ -70,7 +78,7 @@ def create ():
def authenticate():
# TODO: check if the request body contains a chat_id and the correct magic_key for that chat
# TODO: also send a username
return {"session_token": "some_token_value"}
return {"session_token": "as3215jhkg231hjgkl4123"}
@app.route('/api/messages', methods=['GET', 'POST'])
def messages ():
......
<html>
<head>
<title>{{title}}</title>
<link rel="stylesheet" type="text/css" href="static/style.css"></link>
<script src="static/script.js"></script>
</head>
<body>
<div class="container">
<h3> {{header}} </h3>
</div>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment