Skip to content

Commit

Permalink
feat: view-page fetch content by apps
Browse files Browse the repository at this point in the history
  • Loading branch information
attakei committed Nov 24, 2024
1 parent 42074f5 commit ea9106c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/routes/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@
*/

import { Hono } from 'hono';
import { Octokit } from '@octokit/core';
import { fetchContent } from '../client';
import { fetchContent, Client } from '../client';
import { Layout } from '../components/layouts';
import { parseSlug } from '../models';
import { parseContentMarkdown } from '../parser';

const app = new Hono<{ Bindings: CloudflareBindings }>();

app.get('/:slug', async (c) => {
const octokit = new Octokit({
auth: c.env.REPO_PAT,
});
const addr = parseSlug(c.req.param('slug'));
const client = new Client(c);
const octokit = await client.getApp(addr.owner);
try {
const md = await fetchContent(octokit, addr);
const content = parseContentMarkdown(md);
Expand Down

0 comments on commit ea9106c

Please sign in to comment.