mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-10 04:22:12 +00:00
We renamed the GitHub repository from `zeit/now` to `vercel/vercel` so this PR updates all references to the repo URL. There were also a few remaining references to Now CLI that have been updated to Vercel CLI.
49 lines
1.1 KiB
Svelte
49 lines
1.1 KiB
Svelte
<script>
|
|
import { onMount } from "svelte";
|
|
export let date;
|
|
|
|
onMount(async () => {
|
|
const res = await fetch("/api/date");
|
|
const newDate = await res.text();
|
|
date = newDate;
|
|
});
|
|
</script>
|
|
|
|
<main>
|
|
<h1>Svelte + Node.js API</h1>
|
|
<h2>
|
|
Deployed with
|
|
<a href="https://vercel.com/docs" target="_blank" rel="noreferrer noopener">
|
|
Vercel
|
|
</a>
|
|
!
|
|
</h2>
|
|
<p>
|
|
<a
|
|
href="https://github.com/vercel/vercel/tree/master/examples/svelte"
|
|
target="_blank"
|
|
rel="noreferrer noopener">
|
|
This project
|
|
</a>
|
|
is a
|
|
<a href="https://svelte.dev/">Svelte</a>
|
|
app with three directories,
|
|
<code>/public</code>
|
|
for static assets,
|
|
<code>/src</code>
|
|
for components and content, and
|
|
<code>/api</code>
|
|
which contains a serverless
|
|
<a href="https://nodejs.org/en/">Node.js</a>
|
|
function. See
|
|
<a href="/api/date">
|
|
<code>api/date</code>
|
|
for the Date API with Node.js
|
|
</a>
|
|
.
|
|
</p>
|
|
<br />
|
|
<h2>The date according to Node.js is:</h2>
|
|
<p>{date ? date : 'Loading date...'}</p>
|
|
</main>
|