This repository has been archived by the owner on Aug 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 71
Game API
Alexandru Dan edited this page Aug 30, 2017
·
9 revisions
The whole game API is registered inside the urls.py
file:
url(r'^api/code/(?P<id>[0-9]+)/$', views.code, name='aimmo/code'),
url(r'^api/games/$', views.list_games, name='aimmo/games'),
url(r'^api/games/(?P<id>[0-9]+)/$', views.get_game, name='aimmo/game_details'),
url(r'^api/games/(?P<id>[0-9]+)/complete/$', views.mark_game_complete, name='aimmo/complete_game'),
The specific controller are found inside view.py
.
We use a JS reverse proxy exposed to the JS application, so we can easily access the resource URLs from Javascript.
url(r'^jsreverse/$', 'django_js_reverse.views.urls_js', name='aimmo/js_reverse'),
An example of resource access from JS is:
$.ajax({
url: Urls['aimmo/code'](id=GAME_ID),
type: 'GET',
[...]
});