mirror of
https://github.com/coollabsio/coolify-examples.git
synced 2026-02-19 13:58:56 +00:00
new examples
This commit is contained in:
14
node/tanstack-start/static/app/router.tsx
Normal file
14
node/tanstack-start/static/app/router.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import { createRouter as createTanStackRouter } from '@tanstack/react-router';
|
||||
import { routeTree } from './routeTree.gen';
|
||||
|
||||
export function createRouter() {
|
||||
return createTanStackRouter({
|
||||
routeTree,
|
||||
});
|
||||
}
|
||||
|
||||
declare module '@tanstack/react-router' {
|
||||
interface Register {
|
||||
router: ReturnType<typeof createRouter>;
|
||||
}
|
||||
}
|
||||
16
node/tanstack-start/static/app/routes/__root.tsx
Normal file
16
node/tanstack-start/static/app/routes/__root.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import { createRootRoute, Outlet } from '@tanstack/react-router';
|
||||
|
||||
export const Route = createRootRoute({
|
||||
component: () => (
|
||||
<html>
|
||||
<head>
|
||||
<meta charSet="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>TanStack Start</title>
|
||||
</head>
|
||||
<body>
|
||||
<Outlet />
|
||||
</body>
|
||||
</html>
|
||||
),
|
||||
});
|
||||
30
node/tanstack-start/static/app/routes/index.tsx
Normal file
30
node/tanstack-start/static/app/routes/index.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export const Route = createFileRoute('/')({
|
||||
component: Home,
|
||||
});
|
||||
|
||||
function Home() {
|
||||
// Build-time public var (baked into bundle)
|
||||
const buildPublicVar = import.meta.env.VITE_BUILD_PUBLIC_VAR || 'default-value';
|
||||
|
||||
useEffect(() => {
|
||||
console.log('=== Build-time Variables ===');
|
||||
console.log('VITE_BUILD_PUBLIC_VAR:', buildPublicVar);
|
||||
}, [buildPublicVar]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div style={{ padding: '20px', background: '#f0f0f0', margin: '20px', borderRadius: '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', fontSize: '14px' }}>
|
||||
Note: Static sites only support build-time env vars (no server at runtime)
|
||||
</p>
|
||||
</div>
|
||||
<h1>Hello from TanStack Start!</h1>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user