Skip to content

Commit

Permalink
[server] Add /healthz endpoint for Kubernetes, bring back GitHub stuff:
Browse files Browse the repository at this point in the history
  • Loading branch information
auguwu committed Mar 13, 2023
1 parent c526e7e commit ebdd47e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@noel/site",
"description": "🐾 Noel's personal website, blog, and documentation site made with Astro",
"version": "12.3.2",
"version": "12.3.3",
"private": true,
"author": "Noel <[email protected]>",
"homepage": "https://floofy.dev",
Expand Down
1 change: 1 addition & 0 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ async function main() {
root: resolve(DIST_PATH, 'client/_astro')
});

server.get('/healthz', (_, reply) => reply.status(200).send('OK!'));
server.all('*', async (req, reply) => {
for (const [header, value] of Object.entries(reply.getHeaders())) reply.header(header, value);

Expand Down
38 changes: 19 additions & 19 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ import Page from '../components/Page.astro';
import '../styles/global.css';
// const token = import.meta.env.GITHUB_TOKEN;
// const githubRepos = await fetch('https://api.github.com/users/auguwu/repos', {
// headers:
// token !== undefined
// ? {
// Authorization: `token ${token}`
// }
// : {}
// })
// .then((res) => res.json())
// .then((data: any[]) =>
// data
// .sort((a, b) => b.stargazers_count - a.stargazers_count)
// .filter((s) => !s.archived)
// .filter((s) => s.name !== 'auguwu')
// .slice(0, 6)
// );
const token = import.meta.env.GITHUB_TOKEN;
const githubRepos = await fetch('https://api.github.com/users/auguwu/repos', {
headers:
token !== undefined
? {
Authorization: `token ${token}`
}
: {}
})
.then((res) => res.json())
.then((data: any[]) =>
data
.sort((a, b) => b.stargazers_count - a.stargazers_count)
.filter((s) => !s.archived)
.filter((s) => s.name !== 'auguwu')
.slice(0, 6)
);
---

<Page
Expand Down Expand Up @@ -62,7 +62,7 @@ import '../styles/global.css';
</a>
</div>

<!-- <div class="flex container mx-auto mt-6 items-center justify-center lg:hidden">
<div class="flex container mx-auto mt-6 items-center justify-center lg:hidden">
<div class="grid grid-cols-1 gap-6 [&>*]:h-full">
{githubRepos.map((data) => <ProjectCard data={data} />)}
</div>
Expand All @@ -72,6 +72,6 @@ import '../styles/global.css';
<div class="grid grid-cols-3 gap-3 items-center [&>*]:h-full">
{githubRepos.map((data) => <ProjectCard data={data} />)}
</div>
</div> -->
</div>
</Container>
</Page>

0 comments on commit ebdd47e

Please sign in to comment.