This project allows you to view and embed last results and next games for teams and clubs using the API from Handball Schweiz
This is a small react app, optimized to run on Cloudflare Pages. The serverless function will add the club specific auth token for API requests going to the API from Handball Schweiz. You need to set the following environment variables on the cloudflare pages project:
- API_KEY: with the base64 encoded API key from Handball Schweiz
- FRAME_ANCESTORS: set a space separated list of domains which should be added to the frame-ancestor CSP header
You can iframe the following URLs:
- See all results and next games of a club: https://${hostname}/verein/${club.id} where $(club.id) is the ID of the club as seen in the Matchcenter URL of Handball Schweiz: e.g. 140675 for https://www.handball.ch/de/matchcenter/vereine/140675
- See all results and next games of a team: https://${hostname}/team/${team.id} where $(team.id) is the ID of the team as seen in the Matchcenter URL of Handball Schweiz: e.g. 36184 for https://www.handball.ch/de/matchcenter/teams/36184
By default the last 10 and the next 10 games are displayed for both club and team. This can be changed by adding the following query parameters:
- results: for defining the number of played games displayed
- next: for defining the number of planned games displayed
Hence, if you want do display the last 20 results and the next 30 games of club 140675, you would use the following URL:
https://${hostname}/verein/140675?results=20&next=30
This project has been created in collaboration with the HC KTV Altdorf.