1
0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2024-11-10 02:27:29 +00:00
cloudtube/api/channels.js
2020-08-30 01:21:48 +12:00

13 lines
363 B
JavaScript

const fetch = require("node-fetch")
const {render} = require("pinski/plugins")
module.exports = [
{
route: "/channel/([A-Za-z0-9-_]+)", methods: ["GET"], code: async ({fill}) => {
const id = fill[0]
const data = await fetch(`http://localhost:3000/api/v1/channels/${id}`).then(res => res.json())
return render(200, "pug/channel.pug", {data})
}
}
]