Created
September 3, 2022 14:33
-
-
Save skolhustick/3557a84b5b8d422f37c979f145cc7aa1 to your computer and use it in GitHub Desktop.
astro-mongodob-users.index.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/pages/users/index.astro | |
--- | |
import { getAllUsers } from "../../lib/users"; | |
import Layout from "../layouts/Layout.astro"; | |
const users = await getAllUsers(); | |
if (!users) { | |
return new Response(null, { | |
status: 404, | |
statusText: "Not found", | |
}); | |
} | |
--- | |
<Layout> | |
<h1>Users</h1> | |
<ul> | |
{ | |
users.map((user) => ( | |
<li> | |
{user.name}, {user.age} | |
</li> | |
)) | |
} | |
</ul> | |
</Layout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment