Backend for the Emote Widget
- Create an Heroku application:
heroku create <app-name>- Add Heroku Redis Support:
heroku addons:create heroku-redis:hobby-dev- Deploy to Heroku
git push heroku main
Install dependencies:
npm installRun Server in development mode:
npm run start:dev
- REDIS_URL- A Redis connection string
- RATE_LIMIT_MAX- Max number of requests per time window (Default: 100)
- RATE_LIMIT_WINDOW- Duration of the Rate Limit time window (Default: 1 minute)
- HEARTBEAT_TIMEOUT- Duration of the Heartbeat (Default: 30 seconds)
- EVENT_ID_LENGTH- Max length of an Event ID (Default: 32 characters)
- EVENTS_MAX- Max number of Event Streams (Default: 32)
Returns the votes by Event
- id- Represents an Event by ID
{
  "smile": 100,
  "love": 103,
  "plus_one": 5,
  "question": 1
}Submit a vote by Event
- id- Represents an Event by ID
{
  "emote": "smile"
}Body
{
  "message": "emote received"
}Headers
retry-after: 60000
x-ratelimit-limit: 100
x-ratelimit-remaining: 0
x-ratelimit-reset: 39
Body
{
    "error": "Too Many Requests",
    "message": "Rate limit exceeded, retry in 1 minute",
    "statusCode": 429
}Connect to an event stream by Event ID
- emote- An- emotehas been received - (data:- smile)
- votes- A- votesstate object has been received (data:- {"smile": 1, "question": 3})
- heartbeat- A- pinghas been received (data:- ping)
We love contributions, small or big, from others!
Please see our CONTRIBUTING guidelines. The first thing to do is to discuss the change you wish to make via issue, email, or any other method with the owners of this repository.
Also, please review our code of conduct. Please adhere to it in all your interactions with this project.
Thanks goes to these wonderful ✨ people (emoji key) for contributing to the project:
| Clifton Campbell 💻 | Julián Duque 💻 🤔 | 
This project follows the all-contributors specification. Contributions of any kind welcome!
Please review and adhere to our CODE_OF_CONDUCT.md before contributing to this project in any way (e.g. creating an issue, writing code, etc).
This project is licensed under the Creative Commons Zero v1.0 License. See the LICENSE file for details.