-
Notifications
You must be signed in to change notification settings - Fork 45
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
1 parent
6c1104b
commit a10ed93
Showing
8 changed files
with
134 additions
and
45 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
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
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
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
from .views import index, messages | ||
from .views import index, messages, message_data | ||
|
||
|
||
def setup_routes(app): | ||
app.router.add_get('/', index, name='index') | ||
app.router.add_route('*', '/messages', messages, name='messages') | ||
app.router.add_get('/messages/data', message_data, name='message-data') |
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
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
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 |
---|---|---|
@@ -1,14 +1,22 @@ | ||
{# This file is special: lines are made unique and sorted before the new requirements.tzt file is created #} | ||
{# This file is special: lines are made unique, stripped and sorted before the new requirements.txt file is created #} | ||
|
||
aiohttp==1.0.2 | ||
|
||
{% if template_engine.is_jinja2 %} | ||
aiohttp-jinja2==0.8.0 | ||
aiohttp-jinja2==0.8.0 | ||
{% endif %} | ||
|
||
{% if session.is_vanilla %} | ||
aiohttp-session==0.5.0 | ||
aiohttp-session==0.5.0 | ||
{% elif session.is_secure %} | ||
aiohttp-session[secure]==0.5.0 | ||
aiohttp-session[secure]==0.5.0 | ||
{% elif session.is_redis %} | ||
aiohttp-session[aioredis]==0.5.0 | ||
aiohttp-session[aioredis]==0.5.0 | ||
{% endif %} | ||
|
||
{# TODO: others #} | ||
{% if database.is_postgres_sqlalchemy or database.is_postgres_raw %} | ||
aiopg==0.11.0 | ||
{% if database.is_postgres_sqlalchemy %} | ||
SQLAlchemy==1.0.15 | ||
{% endif %} | ||
{% endif %} |
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,30 @@ | ||
// some very basic javascript to populate the message board | ||
// for simplicity this has not external requirements | ||
|
||
var messages = document.getElementById('messages'); | ||
|
||
function request_state_changed() { | ||
if (this.readyState != 4) { | ||
return; | ||
} | ||
if (this.status != 200) { | ||
console.warn('error getting messages:', r); | ||
alert('error getting messages, response:' + this.status); | ||
return; | ||
} | ||
var data = JSON.parse(this.responseText); | ||
if (data.length == 0) { | ||
messages.innerHTML = 'No messages available.' | ||
} else { | ||
messages.innerHTML = '<ul>'; | ||
data.forEach(function (m) { | ||
messages.innerHTML += '<li>' + m.username + ': <b>' + m.message + '</b>, (' + m.timestamp + ')</li>' | ||
}); | ||
messages.innerHTML += '</ul>'; | ||
} | ||
} | ||
|
||
var r = new XMLHttpRequest(); | ||
r.open('GET', messages.getAttribute('data-url'), true); | ||
r.onreadystatechange = request_state_changed; | ||
r.send(''); |