See production deployment here: https://pocky.deno.land/
A REST API for Pocky. It does:
- Store QR codes in the safe place
- Relay sport API (e.g. ESPN) for the chainlink
- Fetches sport API initially to construct the collection metadata
- Deno 1.34 or higher
Start the server with the command:
deno run --allow-net main.ts
This starts the server at http://localhost:8000/
As new commits pushed into main
branch, Deno deploys it automatically.
Fetches the metadata and the result of a match. The matchDate
is YYYYMMDD
format. For response format, please refer SportResult
.
It is being called by Chainlink Oracle nodes.
$ curl https://pocky.deno.land/api/sport/nba/20230527
{
"hasResult": true,
"home": {
"metadata": {
"name": "Miami Heat",
"symbol": "MIA",
"color": "#98002e",
"logo": "https://a.espncdn.com/i/teamlogos/nba/500/scoreboard/mia.png"
},
"score": 103,
"stats": {
"fieldGoalsMade": "33",
"fieldGoalsPct": "35.5%",
"threePointMade": "14",
"threePointPct": "46.7%",
"freeThrowsMade": "23",
"freeThrowPct": "79.3%"
}
},
"away": {
"metadata": {
"name": "Boston Celtics",
"symbol": "BOS",
"color": "#006532",
"logo": "https://a.espncdn.com/i/teamlogos/nba/500/scoreboard/bos.png"
},
"score": 104,
"stats": {
"fieldGoalsMade": "34",
"fieldGoalsPct": "43.6%",
"threePointMade": "7",
"threePointPct": "20.0%",
"freeThrowsMade": "29",
"freeThrowPct": "85.3%"
}
}
}
When match is not held at given date, it returns HTTP 404 Not Found
with NOT_FOUND
code.
{
"error": {
"code": "NOT_FOUND",
"message": "event not found"
}
}
Renders given SVG image as HTML. Used for displaying dynamic-rendered SVG on the NFT platforms that doesn't support loading external images inside SVG. (e.g. OpenSea)
Name | Description | Required | Example |
---|---|---|---|
svg |
Base64 Encoded SVG Image. | Yes | PHN2ZyB3a... |
$ curl https://pocky.deno.dev/render?svg=PHN2ZyB3a...
<html>
<body>
<svg width="848" height="848" viewBox="0 0 848 848" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
...
</svg>
</body>
</html>