Skip to content

Commit

Permalink
api: metadata json blob (#37)
Browse files Browse the repository at this point in the history
1. return a json blob from metadata endpoint
2. update workflow files to skip runs on `api/` changes
  • Loading branch information
yurushao authored Apr 3, 2024
1 parent 93f40ab commit 1c6df44
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/dapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
paths-ignore:
- "api/**" # Skip workflow when changes are made to the api/ directory

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pr_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Build dapp
on:
pull_request:
branches: ["main"]
paths-ignore:
- "api/**" # Skip workflow when changes are made to the api/ directory

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down
15 changes: 9 additions & 6 deletions api/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ const express = require("express");
const { createCanvas, loadImage } = require("canvas");
const { validatePubkey } = require("./validation");

const app = express();
BASE_URL = "https://api.glam.systems";

const app = express();
app.use(express.static("public"));

app.get("/", (req, res) => {
Expand All @@ -20,15 +21,17 @@ app.get("/metadata/:pubkey", async (req, res) => {
return res.sendStatus(404);
}

// TODO: implement metadata fetching
// TODO: Fetch name and symbol from blockchain

const imageUri = `${BASE_URL}/image/${req.params.pubkey}.png`;
res.set("content-type", "application/json");
res.send(
JSON.stringify({
name: "name",
symbol: "symbol",
description: "description",
image: "image url"
name: "name_placeholder",
symbol: "symbol_placeholder",
description: "",
external_url: "https://glam.systems",
image: imageUri
})
);
});
Expand Down

0 comments on commit 1c6df44

Please sign in to comment.