3.5: API
chat.php est déjà écrit, vous n'aurez pas à le modifier.
C'est une situation classique dans laquelle on se retrouve quand on développe en « frontend »:
On développe du code JS « frontend » sur le navigateur.
On accède à un service « backend » existant déjà sur un serveur. Ce « backend » fournit une API.
L'API consiste ici, des URL suivantes:
http://localhost/~(votre numero utilisateur)/chat.php?action=messages
http://localhost/~(votre numero utilisateur)/chat.php?action=nom
http://localhost/~(votre numero utilisateur)/chat.php?action=changer-nom
http://localhost/~(votre numero utilisateur)/chat.php?action=envoyer
http://localhost/~(votre numero utilisateur)/chat.php?action=reinitialiser
http://localhost/~(votre numero utilisateur)/chat.php?action=test
On a déjà vu « test ». On verra comment utiliser chacune d'entre-elles.