initial backend

This commit is contained in:
2025-09-05 13:40:15 +02:00
parent ab588833b6
commit 48c1811c30
16 changed files with 210 additions and 7 deletions

View File

@@ -8,10 +8,11 @@
"build": "vite build"
},
"devDependencies": {
"vite": "^7.1.4",
"vite-plugin-solid": "^2.11.8",
"@types/node": "^24.3.1",
"terser": "^5.44.0",
"typescript": "^5.9.2"
"typescript": "^5.9.2",
"vite": "^7.1.4",
"vite-plugin-solid": "^2.11.8"
},
"dependencies": {
"solid-js": "^1.9.9"

View File

@@ -1,6 +1,20 @@
import type { Component } from "solid-js";
import { createSignal, For, onMount } from "solid-js";
interface Weather {
date: string;
temperatureC: number;
temperatureF: number;
summary: string;
}
const App: Component = () => {
const [weather, setWeather] = createSignal<Weather[]>([]);
onMount(() => {
fetch("/api/weatherforecast")
.then((r) => r.json())
.then(setWeather);
});
return (
<div>
<header>
@@ -15,6 +29,15 @@ const App: Component = () => {
Learn Solid
</a>
</header>
<For each={weather()}>
{(item) => (
<li>
{item.date} - {item.temperatureC}°C / {item.temperatureF}°F -{" "}
{item.summary}
</li>
)}
</For>
</div>
);
};

View File

@@ -3,12 +3,12 @@
"strict": true,
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"jsx": "preserve",
"jsxImportSource": "solid-js",
"types": ["vite/client"],
"types": ["vite/client", "node"],
"noEmit": true,
"isolatedModules": true
}

View File

@@ -1,8 +1,9 @@
import { defineConfig } from "vite";
import solidPlugin from "vite-plugin-solid";
import { env } from "process";
//test
const target = env.BACKEND_URL ?? "https://localhost:5001";
const target = env.BACKEND_URL ?? "http://localhost:5084/"; //"https://localhost:7192/";
console.log("vite backend:", target);
export default defineConfig({
plugins: [solidPlugin()],

View File

@@ -475,6 +475,13 @@
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.8.tgz#958b91c991b1867ced318bedea0e215ee050726e"
integrity sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==
"@types/node@^24.3.1":
version "24.3.1"
resolved "https://registry.yarnpkg.com/@types/node/-/node-24.3.1.tgz#b0a3fb2afed0ef98e8d7f06d46ef6349047709f3"
integrity sha512-3vXmQDXy+woz+gnrTvuvNrPzekOi+Ds0ReMxw0LzBiK3a+1k0kQn9f2NWk+lgD4rJehFUmYy2gMhJ2ZI+7YP9g==
dependencies:
undici-types "~7.10.0"
acorn@^8.15.0:
version "8.15.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.15.0.tgz#a360898bc415edaac46c8241f6383975b930b816"
@@ -787,6 +794,11 @@ typescript@^5.9.2:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.2.tgz#d93450cddec5154a2d5cabe3b8102b83316fb2a6"
integrity sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==
undici-types@~7.10.0:
version "7.10.0"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.10.0.tgz#4ac2e058ce56b462b056e629cc6a02393d3ff350"
integrity sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==
update-browserslist-db@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz#348377dd245216f9e7060ff50b15a1b740b75420"