Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a Django endpoint?

I have made a Django/jQuery/JS Tug O' War app in which users button mash their specific key in attempts to pull the HTML <img> tag all the way to their side of the screen. When a user wins, The Game/Player model fields are updated and the game starts over. Some of those fields are total amount of key presses it took to win the game, who won/lost, and how many wins/losses each player has.

The project I am working on asks that I create a new Django endpoint for leaderboards that display some simple game statistics.

What is a Django endpoint?

Is it just a fancy word for making a normal leader board? Or am I suppose to do something special? They suggest that I use Mustache while making it (can't find much of an explaination about what that is either).

I cannot seem to find relevant information on Stack Overflow or the interwebs. At this point I have been searching for an answer for about 2 hours.

Here is a link to the project instructions..

Tug O' War

like image 720
Erik Åsland Avatar asked Dec 20 '15 19:12

Erik Åsland


People also ask

What is an API endpoint in Django rest?

First, a few resources: read more about API endpoints in this previous blog post and review documentation on Django Rest Framework. A typical request for an API endpoint may be something like: 'the front end app needs to be able to read, create, and update companies through the API'.

What is Django REST framework?

Why Django Rest Framework? What is an API? Django Rest Framework lets you create RESTful APIs: A way to transfer information between an interface and a database in a simple way. It separates user interface and data storage and communicates user and database sending a .json file.

How to use Django-specific APIs in Jinja2 templates?

In order to use Django-specific APIs, you must configure them into the environment. For example, you can create myproject/jinja2.py with this content: and set the 'environment' option to 'myproject.jinja2.environment'. Then you could use the following constructs in Jinja2 templates:

What is the best template language for Django?

The Django template language is Django’s own template system. Until Django 1.8 it was the only built-in option available. It’s a good template library even though it’s fairly opinionated and sports a few idiosyncrasies.


1 Answers

It seems they expect to create an API to send data to javascript, then using a templating engine like mustache, you create a leader page.

The master keyword here is : ajax.

Display the leaderboards on the bottom of your game page. Use AJAX to load each leaderboard on game start. It should update when the game is finished, and the last game played should be present if applicable.

When someone need you to do a work using ajax, that means you need to server data only from the server and handle remains in UI.

like image 73
Ali Nikneshan Avatar answered Oct 22 '22 22:10

Ali Nikneshan