Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ dist-ssr
*.sln
*.sw?

# Local Netlify folder
.netlify/
5 changes: 5 additions & 0 deletions netlify/functions/hello.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// route: BASEURL/api/hello
// example: GET https://deploy-preview-10--react-vite-base.netlify.app/api/hello
export default () => new Response("hello!");

export const config = { path: "/api/hello" };
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"lint": "biome ci ./src",
"format": "biome format --write ./src",
"style-check": "biome check --write ./src",
"dev": "vite --open",
"dev": "netlify dev",
"dev:client-only": "vite --open",
"build": "tsc -b && vite build",
"test": "vitest run",
"test:watch": "vitest",
Expand All @@ -19,6 +20,7 @@
},
"dependencies": {
"@barbajoe/css-lib": "0.2.1",
"@netlify/functions": "3.0.0",
"react": "19.0.0",
"react-dom": "19.0.0",
"react-router-dom": "7.1.5"
Expand Down
31 changes: 31 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 33 additions & 16 deletions src/components/Welcome/Welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,39 @@ export const Welcome = () => {
<main>
<h1>Vite + React + @barbajoe/css-lib</h1>

<p>
Hello {name}! Click the button to see the most basic of ways to use{" "}
<code>useState</code>
</p>

<button type="button" onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>

<p>
Or, edit <code>src/**.tsx</code> and save to test HMR
</p>

<p>
OR! You can edit the global <code>name</code> value in the About page.
</p>
<section>
<p>
Hello {name}! Click the button to see the most basic of ways to use{" "}
<code>useState</code>
</p>

<button type="button" onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>

<p>
Or, edit <code>src/**.tsx</code> and save to test HMR
</p>

<p>
OR! You can edit the global <code>name</code> value in the About page.
</p>
</section>

<section>
<h2>Now with AWS Lambda (via Netlify Serverless) functions!</h2>

<p>Get the super basic "hello" result by clicking here:</p>

<button
type="button"
onClick={() =>
fetch("/api/hello").then((r) => r.text().then((t) => alert(t)))
}
>
GET 'hello'
</button>
</section>
</main>
);
};