Compare commits

..

2 Commits

Author SHA1 Message Date
ed barz 928c40d757 env check 2023-05-27 12:02:38 +02:00
ed barz 5ecb37b40e .env dev and prod files added for API endpoints 2023-05-27 12:01:04 +02:00
6 changed files with 20 additions and 3 deletions

1
.env.development Normal file
View File

@ -0,0 +1 @@
VITE_API_URL=http://localhost:8069

0
.env.production Normal file
View File

1
.gitignore vendored
View File

@ -4,7 +4,6 @@ node_modules
/.svelte-kit
/package
.env
.env.*
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

11
package-lock.json generated
View File

@ -7,6 +7,9 @@
"": {
"name": "brz9front",
"version": "0.0.1",
"dependencies": {
"dotenv": "^16.0.3"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/adapter-node": "^1.2.4",
@ -1003,6 +1006,14 @@
"node": ">=6.0.0"
}
},
"node_modules/dotenv": {
"version": "16.0.3",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz",
"integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==",
"engines": {
"node": ">=12"
}
},
"node_modules/esbuild": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz",

View File

@ -21,5 +21,8 @@
"svelte": "^3.54.0",
"vite": "^4.3.0"
},
"type": "module"
"type": "module",
"dependencies": {
"dotenv": "^16.0.3"
}
}

View File

@ -1,5 +1,6 @@
<script>
let text = '';
const apiUrl = import.meta.env.VITE_API_URL;
async function createNote() {
const response = await fetch('https://api.brz9.dev/notes', {
@ -55,4 +56,6 @@
{#each notes as note}
<li>{note.Text}</li>
{/each}
</ul>
</ul>
<h4>Just to check, the current API endpoint is : {apiUrl}</h4>