Skip to content

Commit

Permalink
#18 Creating a explore page for servers (#33)
Browse files Browse the repository at this point in the history
adding new page for exploring servers
  • Loading branch information
Latish705 authored May 23, 2024
1 parent 0ef82a4 commit bfc8bb2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/(setup)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ const serverExplorerPage = async () => {
</div>
);
};
export default serverExplorerPage;
export default serverExplorerPage;
17 changes: 17 additions & 0 deletions app/api/servers/getAllServers/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { supabase } from "@/components/client";
import { Request, Response } from "express";

export async function GET(req: Request, res: Response) {
try {
const { data: servers, error } = await supabase.from("Server").select();
if (error) {
console.error(error);
res.status(500).json({ error: "Internal Server Error" });
} else {
res.status(200).json(servers);
}
} catch (error: any) {
console.error("Error fetching servers:", error.message);
res.status(500).json({ error: "Internal Server Error" });
}
}

0 comments on commit bfc8bb2

Please sign in to comment.