An example chat server in golang.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 

26 lignes
992 B

<!DOCTYPE html>
<html>
<head><title>Sample Chat</title></head>
<body>
<pre><code># Ask for an auth code (swap sub)
curl -X POST http://localhost:4080/api/sessions \
-H 'Content-Type: application/json; charset=utf-8' \
-d '{"sub":"<strong><em>jon@example.com</em></strong>"}'
# Validate auth code (swap session id, sub, and otp)
curl -X POST http://localhost:4080/api/sessions/<strong><em>xyz</em></strong> \
-H 'Content-Type: application/json; charset=utf-8' \
-d '{"otp":"<strong><em>secret123</em></strong>"}'
# Post a message (swap api-token)
curl -X POST http://localhost:4080/api/rooms/general \
-H 'Authorization: Bearer <strong><em>api-token</em></strong>' \
-H 'Content-Type: application/json; charset=utf-8' \
-d '{"message":"Hello, World!"}'
# Get a room's messages (swap api-token, since unix-epoch)
curl http://localhost:4080/api/rooms/general?since=0 \
-H 'Authorization: Bearer <strong><em>api-token</em></strong>'
</code></pre>
</body>
</html>