mirror of
https://github.com/coollabsio/coolify-examples.git
synced 2026-02-19 22:08:58 +00:00
new examples
This commit is contained in:
11
node/solid-start/ssr/.dockerignore
Normal file
11
node/solid-start/ssr/.dockerignore
Normal file
@@ -0,0 +1,11 @@
|
||||
node_modules/
|
||||
.git/
|
||||
.gitignore
|
||||
.env
|
||||
.env.local
|
||||
*.md
|
||||
.DS_Store
|
||||
*.log
|
||||
npm-debug.log*
|
||||
.vinxi/
|
||||
.output/
|
||||
28
node/solid-start/ssr/.gitignore
vendored
Normal file
28
node/solid-start/ssr/.gitignore
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
dist
|
||||
.wrangler
|
||||
.output
|
||||
.vercel
|
||||
.netlify
|
||||
.vinxi
|
||||
app.config.timestamp_*.js
|
||||
|
||||
# Environment
|
||||
.env
|
||||
.env*.local
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
|
||||
# IDEs and editors
|
||||
/.idea
|
||||
.project
|
||||
.classpath
|
||||
*.launch
|
||||
.settings/
|
||||
|
||||
# Temp
|
||||
gitignore
|
||||
|
||||
# System Files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
32
node/solid-start/ssr/README.md
Normal file
32
node/solid-start/ssr/README.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# SolidStart
|
||||
|
||||
Everything you need to build a Solid project, powered by [`solid-start`](https://start.solidjs.com);
|
||||
|
||||
## Creating a project
|
||||
|
||||
```bash
|
||||
# create a new project in the current directory
|
||||
npm init solid@latest
|
||||
|
||||
# create a new project in my-app
|
||||
npm init solid@latest my-app
|
||||
```
|
||||
|
||||
## Developing
|
||||
|
||||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
|
||||
# or start the server and open the app in a new browser tab
|
||||
npm run dev -- --open
|
||||
```
|
||||
|
||||
## Building
|
||||
|
||||
Solid apps are built with _presets_, which optimise your project for deployment to different environments.
|
||||
|
||||
By default, `npm run build` will generate a Node app that you can run with `npm start`. To use a different preset, add it to the `devDependencies` in `package.json` and specify in your `app.config.js`.
|
||||
|
||||
## This project was created with the [Solid CLI](https://github.com/solidjs-community/solid-cli)
|
||||
3
node/solid-start/ssr/app.config.ts
Normal file
3
node/solid-start/ssr/app.config.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { defineConfig } from "@solidjs/start/config";
|
||||
|
||||
export default defineConfig({});
|
||||
20
node/solid-start/ssr/package.json
Normal file
20
node/solid-start/ssr/package.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "example-basic",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vinxi dev",
|
||||
"build": "vinxi build",
|
||||
"start": "vinxi start",
|
||||
"version": "vinxi version"
|
||||
},
|
||||
"dependencies": {
|
||||
"@solidjs/meta": "^0.29.4",
|
||||
"@solidjs/router": "^0.15.0",
|
||||
"@solidjs/start": "^1.1.0",
|
||||
"solid-js": "^1.9.5",
|
||||
"vinxi": "^0.5.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22"
|
||||
}
|
||||
}
|
||||
BIN
node/solid-start/ssr/public/favicon.ico
Normal file
BIN
node/solid-start/ssr/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 664 B |
39
node/solid-start/ssr/src/app.css
Normal file
39
node/solid-start/ssr/src/app.css
Normal file
@@ -0,0 +1,39 @@
|
||||
body {
|
||||
font-family: Gordita, Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
margin-right: 1rem;
|
||||
}
|
||||
|
||||
main {
|
||||
text-align: center;
|
||||
padding: 1em;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #335d92;
|
||||
text-transform: uppercase;
|
||||
font-size: 4rem;
|
||||
font-weight: 100;
|
||||
line-height: 1.1;
|
||||
margin: 4rem auto;
|
||||
max-width: 14rem;
|
||||
}
|
||||
|
||||
p {
|
||||
max-width: 14rem;
|
||||
margin: 2rem auto;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
@media (min-width: 480px) {
|
||||
h1 {
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
p {
|
||||
max-width: none;
|
||||
}
|
||||
}
|
||||
22
node/solid-start/ssr/src/app.tsx
Normal file
22
node/solid-start/ssr/src/app.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import { MetaProvider, Title } from "@solidjs/meta";
|
||||
import { Router } from "@solidjs/router";
|
||||
import { FileRoutes } from "@solidjs/start/router";
|
||||
import { Suspense } from "solid-js";
|
||||
import "./app.css";
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<Router
|
||||
root={props => (
|
||||
<MetaProvider>
|
||||
<Title>SolidStart - Basic</Title>
|
||||
<a href="/">Index</a>
|
||||
<a href="/about">About</a>
|
||||
<Suspense>{props.children}</Suspense>
|
||||
</MetaProvider>
|
||||
)}
|
||||
>
|
||||
<FileRoutes />
|
||||
</Router>
|
||||
);
|
||||
}
|
||||
21
node/solid-start/ssr/src/components/Counter.css
Normal file
21
node/solid-start/ssr/src/components/Counter.css
Normal file
@@ -0,0 +1,21 @@
|
||||
.increment {
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
padding: 1em 2em;
|
||||
color: #335d92;
|
||||
background-color: rgba(68, 107, 158, 0.1);
|
||||
border-radius: 2em;
|
||||
border: 2px solid rgba(68, 107, 158, 0);
|
||||
outline: none;
|
||||
width: 200px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.increment:focus {
|
||||
border: 2px solid #335d92;
|
||||
}
|
||||
|
||||
.increment:active {
|
||||
background-color: rgba(68, 107, 158, 0.2);
|
||||
}
|
||||
11
node/solid-start/ssr/src/components/Counter.tsx
Normal file
11
node/solid-start/ssr/src/components/Counter.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import { createSignal } from "solid-js";
|
||||
import "./Counter.css";
|
||||
|
||||
export default function Counter() {
|
||||
const [count, setCount] = createSignal(0);
|
||||
return (
|
||||
<button class="increment" onClick={() => setCount(count() + 1)} type="button">
|
||||
Clicks: {count()}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
4
node/solid-start/ssr/src/entry-client.tsx
Normal file
4
node/solid-start/ssr/src/entry-client.tsx
Normal file
@@ -0,0 +1,4 @@
|
||||
// @refresh reload
|
||||
import { mount, StartClient } from "@solidjs/start/client";
|
||||
|
||||
mount(() => <StartClient />, document.getElementById("app")!);
|
||||
21
node/solid-start/ssr/src/entry-server.tsx
Normal file
21
node/solid-start/ssr/src/entry-server.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
// @refresh reload
|
||||
import { createHandler, StartServer } from "@solidjs/start/server";
|
||||
|
||||
export default createHandler(() => (
|
||||
<StartServer
|
||||
document={({ assets, children, scripts }) => (
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
{assets}
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">{children}</div>
|
||||
{scripts}
|
||||
</body>
|
||||
</html>
|
||||
)}
|
||||
/>
|
||||
));
|
||||
1
node/solid-start/ssr/src/global.d.ts
vendored
Normal file
1
node/solid-start/ssr/src/global.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/// <reference types="@solidjs/start/env" />
|
||||
19
node/solid-start/ssr/src/routes/[...404].tsx
Normal file
19
node/solid-start/ssr/src/routes/[...404].tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Title } from "@solidjs/meta";
|
||||
import { HttpStatusCode } from "@solidjs/start";
|
||||
|
||||
export default function NotFound() {
|
||||
return (
|
||||
<main>
|
||||
<Title>Not Found</Title>
|
||||
<HttpStatusCode code={404} />
|
||||
<h1>Page Not Found</h1>
|
||||
<p>
|
||||
Visit{" "}
|
||||
<a href="https://start.solidjs.com" target="_blank">
|
||||
start.solidjs.com
|
||||
</a>{" "}
|
||||
to learn how to build SolidStart apps.
|
||||
</p>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
10
node/solid-start/ssr/src/routes/about.tsx
Normal file
10
node/solid-start/ssr/src/routes/about.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Title } from "@solidjs/meta";
|
||||
|
||||
export default function About() {
|
||||
return (
|
||||
<main>
|
||||
<Title>About</Title>
|
||||
<h1>About</h1>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
17
node/solid-start/ssr/src/routes/api/env.ts
Normal file
17
node/solid-start/ssr/src/routes/api/env.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { json } from "@solidjs/router";
|
||||
import type { APIEvent } from "@solidjs/start/server";
|
||||
|
||||
// Runtime env vars (read at server startup)
|
||||
const RUNTIME_PRIVATE_VAR = process.env.RUNTIME_PRIVATE_VAR || 'default-value';
|
||||
const RUNTIME_PUBLIC_VAR = process.env.RUNTIME_PUBLIC_VAR || 'default-value';
|
||||
|
||||
console.log('=== Runtime Variables ===');
|
||||
console.log('RUNTIME_PRIVATE_VAR:', RUNTIME_PRIVATE_VAR);
|
||||
console.log('RUNTIME_PUBLIC_VAR:', RUNTIME_PUBLIC_VAR);
|
||||
|
||||
export function GET(event: APIEvent) {
|
||||
return json({
|
||||
runtimePrivateVar: RUNTIME_PRIVATE_VAR,
|
||||
runtimePublicVar: RUNTIME_PUBLIC_VAR,
|
||||
});
|
||||
}
|
||||
54
node/solid-start/ssr/src/routes/index.tsx
Normal file
54
node/solid-start/ssr/src/routes/index.tsx
Normal file
@@ -0,0 +1,54 @@
|
||||
import { Title } from "@solidjs/meta";
|
||||
import { createSignal, onMount } from "solid-js";
|
||||
import Counter from "~/components/Counter";
|
||||
|
||||
export default function Home() {
|
||||
// Build-time public var (baked into bundle)
|
||||
const buildPublicVar = import.meta.env.VITE_BUILD_PUBLIC_VAR || 'default-value';
|
||||
|
||||
// Runtime vars (fetched from server API)
|
||||
const [runtimePrivateVar, setRuntimePrivateVar] = createSignal('loading...');
|
||||
const [runtimePublicVar, setRuntimePublicVar] = createSignal('loading...');
|
||||
|
||||
onMount(async () => {
|
||||
console.log('=== Build-time Variables ===');
|
||||
console.log('VITE_BUILD_PUBLIC_VAR:', buildPublicVar);
|
||||
|
||||
// Fetch runtime vars from server API
|
||||
try {
|
||||
const res = await fetch('/api/env');
|
||||
const data = await res.json();
|
||||
setRuntimePrivateVar(data.runtimePrivateVar);
|
||||
setRuntimePublicVar(data.runtimePublicVar);
|
||||
console.log('=== Runtime Variables ===');
|
||||
console.log('RUNTIME_PRIVATE_VAR:', data.runtimePrivateVar);
|
||||
console.log('RUNTIME_PUBLIC_VAR:', data.runtimePublicVar);
|
||||
} catch {
|
||||
setRuntimePrivateVar('error');
|
||||
setRuntimePublicVar('error');
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<main>
|
||||
<Title>Hello World</Title>
|
||||
<div style={{ padding: '20px', background: '#f0f0f0', margin: '20px', 'border-radius': '8px' }}>
|
||||
<h2>Environment Variable Test</h2>
|
||||
<h3>Build-time (baked into bundle)</h3>
|
||||
<p><strong>VITE_BUILD_PUBLIC_VAR:</strong> {buildPublicVar}</p>
|
||||
<h3>Runtime (read at server startup)</h3>
|
||||
<p><strong>RUNTIME_PRIVATE_VAR:</strong> {runtimePrivateVar()}</p>
|
||||
<p><strong>RUNTIME_PUBLIC_VAR:</strong> {runtimePublicVar()}</p>
|
||||
</div>
|
||||
<h1>Hello world!</h1>
|
||||
<Counter />
|
||||
<p>
|
||||
Visit{" "}
|
||||
<a href="https://start.solidjs.com" target="_blank">
|
||||
start.solidjs.com
|
||||
</a>{" "}
|
||||
to learn how to build SolidStart apps.
|
||||
</p>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
19
node/solid-start/ssr/tsconfig.json
Normal file
19
node/solid-start/ssr/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true,
|
||||
"jsx": "preserve",
|
||||
"jsxImportSource": "solid-js",
|
||||
"allowJs": true,
|
||||
"strict": true,
|
||||
"noEmit": true,
|
||||
"types": ["vinxi/types/client"],
|
||||
"isolatedModules": true,
|
||||
"paths": {
|
||||
"~/*": ["./src/*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
11
node/solid-start/static/.dockerignore
Normal file
11
node/solid-start/static/.dockerignore
Normal file
@@ -0,0 +1,11 @@
|
||||
node_modules/
|
||||
.git/
|
||||
.gitignore
|
||||
.env
|
||||
.env.local
|
||||
*.md
|
||||
.DS_Store
|
||||
*.log
|
||||
npm-debug.log*
|
||||
.vinxi/
|
||||
.output/
|
||||
28
node/solid-start/static/.gitignore
vendored
Normal file
28
node/solid-start/static/.gitignore
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
dist
|
||||
.wrangler
|
||||
.output
|
||||
.vercel
|
||||
.netlify
|
||||
.vinxi
|
||||
app.config.timestamp_*.js
|
||||
|
||||
# Environment
|
||||
.env
|
||||
.env*.local
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
|
||||
# IDEs and editors
|
||||
/.idea
|
||||
.project
|
||||
.classpath
|
||||
*.launch
|
||||
.settings/
|
||||
|
||||
# Temp
|
||||
gitignore
|
||||
|
||||
# System Files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
32
node/solid-start/static/README.md
Normal file
32
node/solid-start/static/README.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# SolidStart
|
||||
|
||||
Everything you need to build a Solid project, powered by [`solid-start`](https://start.solidjs.com);
|
||||
|
||||
## Creating a project
|
||||
|
||||
```bash
|
||||
# create a new project in the current directory
|
||||
npm init solid@latest
|
||||
|
||||
# create a new project in my-app
|
||||
npm init solid@latest my-app
|
||||
```
|
||||
|
||||
## Developing
|
||||
|
||||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
|
||||
# or start the server and open the app in a new browser tab
|
||||
npm run dev -- --open
|
||||
```
|
||||
|
||||
## Building
|
||||
|
||||
Solid apps are built with _presets_, which optimise your project for deployment to different environments.
|
||||
|
||||
By default, `npm run build` will generate a Node app that you can run with `npm start`. To use a different preset, add it to the `devDependencies` in `package.json` and specify in your `app.config.js`.
|
||||
|
||||
## This project was created with the [Solid CLI](https://github.com/solidjs-community/solid-cli)
|
||||
6
node/solid-start/static/app.config.ts
Normal file
6
node/solid-start/static/app.config.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { defineConfig } from "@solidjs/start/config";
|
||||
|
||||
export default defineConfig({
|
||||
ssr: false,
|
||||
});
|
||||
|
||||
20
node/solid-start/static/package.json
Normal file
20
node/solid-start/static/package.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "example-basic",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vinxi dev",
|
||||
"build": "vinxi build",
|
||||
"start": "npx serve@latest .output/public",
|
||||
"version": "vinxi version"
|
||||
},
|
||||
"dependencies": {
|
||||
"@solidjs/meta": "^0.29.4",
|
||||
"@solidjs/router": "^0.15.0",
|
||||
"@solidjs/start": "^1.1.0",
|
||||
"solid-js": "^1.9.5",
|
||||
"vinxi": "^0.5.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22"
|
||||
}
|
||||
}
|
||||
BIN
node/solid-start/static/public/favicon.ico
Normal file
BIN
node/solid-start/static/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 664 B |
39
node/solid-start/static/src/app.css
Normal file
39
node/solid-start/static/src/app.css
Normal file
@@ -0,0 +1,39 @@
|
||||
body {
|
||||
font-family: Gordita, Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
margin-right: 1rem;
|
||||
}
|
||||
|
||||
main {
|
||||
text-align: center;
|
||||
padding: 1em;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #335d92;
|
||||
text-transform: uppercase;
|
||||
font-size: 4rem;
|
||||
font-weight: 100;
|
||||
line-height: 1.1;
|
||||
margin: 4rem auto;
|
||||
max-width: 14rem;
|
||||
}
|
||||
|
||||
p {
|
||||
max-width: 14rem;
|
||||
margin: 2rem auto;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
@media (min-width: 480px) {
|
||||
h1 {
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
p {
|
||||
max-width: none;
|
||||
}
|
||||
}
|
||||
22
node/solid-start/static/src/app.tsx
Normal file
22
node/solid-start/static/src/app.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import { MetaProvider, Title } from "@solidjs/meta";
|
||||
import { Router } from "@solidjs/router";
|
||||
import { FileRoutes } from "@solidjs/start/router";
|
||||
import { Suspense } from "solid-js";
|
||||
import "./app.css";
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<Router
|
||||
root={props => (
|
||||
<MetaProvider>
|
||||
<Title>SolidStart - Basic</Title>
|
||||
<a href="/">Index</a>
|
||||
<a href="/about">About</a>
|
||||
<Suspense>{props.children}</Suspense>
|
||||
</MetaProvider>
|
||||
)}
|
||||
>
|
||||
<FileRoutes />
|
||||
</Router>
|
||||
);
|
||||
}
|
||||
21
node/solid-start/static/src/components/Counter.css
Normal file
21
node/solid-start/static/src/components/Counter.css
Normal file
@@ -0,0 +1,21 @@
|
||||
.increment {
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
padding: 1em 2em;
|
||||
color: #335d92;
|
||||
background-color: rgba(68, 107, 158, 0.1);
|
||||
border-radius: 2em;
|
||||
border: 2px solid rgba(68, 107, 158, 0);
|
||||
outline: none;
|
||||
width: 200px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.increment:focus {
|
||||
border: 2px solid #335d92;
|
||||
}
|
||||
|
||||
.increment:active {
|
||||
background-color: rgba(68, 107, 158, 0.2);
|
||||
}
|
||||
11
node/solid-start/static/src/components/Counter.tsx
Normal file
11
node/solid-start/static/src/components/Counter.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import { createSignal } from "solid-js";
|
||||
import "./Counter.css";
|
||||
|
||||
export default function Counter() {
|
||||
const [count, setCount] = createSignal(0);
|
||||
return (
|
||||
<button class="increment" onClick={() => setCount(count() + 1)} type="button">
|
||||
Clicks: {count()}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
4
node/solid-start/static/src/entry-client.tsx
Normal file
4
node/solid-start/static/src/entry-client.tsx
Normal file
@@ -0,0 +1,4 @@
|
||||
// @refresh reload
|
||||
import { mount, StartClient } from "@solidjs/start/client";
|
||||
|
||||
mount(() => <StartClient />, document.getElementById("app")!);
|
||||
21
node/solid-start/static/src/entry-server.tsx
Normal file
21
node/solid-start/static/src/entry-server.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
// @refresh reload
|
||||
import { createHandler, StartServer } from "@solidjs/start/server";
|
||||
|
||||
export default createHandler(() => (
|
||||
<StartServer
|
||||
document={({ assets, children, scripts }) => (
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
{assets}
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">{children}</div>
|
||||
{scripts}
|
||||
</body>
|
||||
</html>
|
||||
)}
|
||||
/>
|
||||
));
|
||||
1
node/solid-start/static/src/global.d.ts
vendored
Normal file
1
node/solid-start/static/src/global.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/// <reference types="@solidjs/start/env" />
|
||||
19
node/solid-start/static/src/routes/[...404].tsx
Normal file
19
node/solid-start/static/src/routes/[...404].tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Title } from "@solidjs/meta";
|
||||
import { HttpStatusCode } from "@solidjs/start";
|
||||
|
||||
export default function NotFound() {
|
||||
return (
|
||||
<main>
|
||||
<Title>Not Found</Title>
|
||||
<HttpStatusCode code={404} />
|
||||
<h1>Page Not Found</h1>
|
||||
<p>
|
||||
Visit{" "}
|
||||
<a href="https://start.solidjs.com" target="_blank">
|
||||
start.solidjs.com
|
||||
</a>{" "}
|
||||
to learn how to build SolidStart apps.
|
||||
</p>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
10
node/solid-start/static/src/routes/about.tsx
Normal file
10
node/solid-start/static/src/routes/about.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Title } from "@solidjs/meta";
|
||||
|
||||
export default function About() {
|
||||
return (
|
||||
<main>
|
||||
<Title>About</Title>
|
||||
<h1>About</h1>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
36
node/solid-start/static/src/routes/index.tsx
Normal file
36
node/solid-start/static/src/routes/index.tsx
Normal file
@@ -0,0 +1,36 @@
|
||||
import { Title } from "@solidjs/meta";
|
||||
import { onMount } from "solid-js";
|
||||
import Counter from "~/components/Counter";
|
||||
|
||||
export default function Home() {
|
||||
// Build-time public var (baked into bundle)
|
||||
const buildPublicVar = import.meta.env.VITE_BUILD_PUBLIC_VAR || 'default-value';
|
||||
|
||||
onMount(() => {
|
||||
console.log('=== Build-time Variables ===');
|
||||
console.log('VITE_BUILD_PUBLIC_VAR:', buildPublicVar);
|
||||
});
|
||||
|
||||
return (
|
||||
<main>
|
||||
<Title>Hello World</Title>
|
||||
<div style={{ padding: '20px', background: '#f0f0f0', margin: '20px', 'border-radius': '8px' }}>
|
||||
<h2>Environment Variable Test</h2>
|
||||
<h3>Build-time (baked into bundle)</h3>
|
||||
<p><strong>VITE_BUILD_PUBLIC_VAR:</strong> {buildPublicVar}</p>
|
||||
<p style={{ color: '#666', 'font-size': '14px' }}>
|
||||
Note: Static sites only support build-time env vars (no server at runtime)
|
||||
</p>
|
||||
</div>
|
||||
<h1>Hello world!</h1>
|
||||
<Counter />
|
||||
<p>
|
||||
Visit{" "}
|
||||
<a href="https://start.solidjs.com" target="_blank">
|
||||
start.solidjs.com
|
||||
</a>{" "}
|
||||
to learn how to build SolidStart apps.
|
||||
</p>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
19
node/solid-start/static/tsconfig.json
Normal file
19
node/solid-start/static/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true,
|
||||
"jsx": "preserve",
|
||||
"jsxImportSource": "solid-js",
|
||||
"allowJs": true,
|
||||
"strict": true,
|
||||
"noEmit": true,
|
||||
"types": ["vinxi/types/client"],
|
||||
"isolatedModules": true,
|
||||
"paths": {
|
||||
"~/*": ["./src/*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user