Update README with project details and setup instructions; add data directories to .gitignore
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
/**
|
||||
* Resolves the API base URL that Aspire injected. `WithReference(api)` publishes each endpoint as
|
||||
* `services__api__<scheme>__<index>`. Outside Aspire the fallback lets a plain `npm run dev` still work.
|
||||
*/
|
||||
function resolveApiUrl(): string {
|
||||
const fromAspire = Object.keys(process.env)
|
||||
.filter((key) => key.startsWith('services__api__'))
|
||||
// Ascending order puts `http` ahead of `https`; plain HTTP is the simpler hop for a local proxy.
|
||||
.sort()
|
||||
.map((key) => process.env[key])
|
||||
.find((value): value is string => !!value);
|
||||
|
||||
// Matches the `http` launch profile of TheLivingWorld.Api.
|
||||
return fromAspire ?? process.env.API_URL ?? 'http://localhost:5195';
|
||||
}
|
||||
|
||||
export default defineConfig(() => {
|
||||
const apiUrl = resolveApiUrl();
|
||||
|
||||
return {
|
||||
server: {
|
||||
port: process.env.PORT ? Number(process.env.PORT) : 5173,
|
||||
strictPort: true,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: apiUrl,
|
||||
changeOrigin: true,
|
||||
// Aspire issues a development certificate the proxy has no reason to distrust.
|
||||
secure: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
build: {
|
||||
target: 'es2022',
|
||||
sourcemap: true,
|
||||
},
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user