Skip to content

Commit

Permalink
migrated db examples to client_db.
Browse files Browse the repository at this point in the history
  • Loading branch information
bjmckenz committed Apr 13, 2024
1 parent 970de5a commit 32be9ad
Show file tree
Hide file tree
Showing 13 changed files with 119 additions and 718 deletions.
Binary file removed data/containers.db
Binary file not shown.
596 changes: 113 additions & 483 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
},
"type": "module",
"dependencies": {
"better-sqlite3": "^9.4.3",
"smui-theme": "^7.0.0-beta.16"
}
}
39 changes: 0 additions & 39 deletions src/lib/ContainerSummaryRow.svelte

This file was deleted.

30 changes: 0 additions & 30 deletions src/lib/ContainerTable.svelte

This file was deleted.

13 changes: 0 additions & 13 deletions src/lib/server/database.js

This file was deleted.

25 changes: 4 additions & 21 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,19 @@
<h1>Welcome to simple Client/API site</h1>
<p>Bits and pieces to get started in Svelte and API</p>

<p>Step 1: Understand how this route works.</p>
<button on:click={() => {goto('/fromstatic')}}>Show hard-coded Containers</button>

<p>Step 2: Display data from an API</p>
<p>Step 1: Display data from an API</p>
<button on:click={() => {goto('/fromapi')}}>Show Containers via API</button>

<p>Step 3: Set up site-wide layout</p>
<p class=note>(go look at +layout.svelte)</p>

<p>Step 4: Use Svelte MUI to display data</p>
<p>Step 2: Use Svelte MUI to display data</p>
<button on:click={() => {goto('/fromapi_mui')}}>Show Containers in nice table</button>

<p>Step 5: Use a "form" to collect user data and make an API request</p>
<p>Step 3: Use a "form" to collect user data and make an API request</p>
<button on:click={() => {goto('/fetchContainer')}}>Fetch A Container</button>

<p>Step 6: See how to collect data and make a POST request</p>
<p>Step 4: See how to collect data and make a POST request</p>
<button on:click={() => {goto('/createContainer')}}>Create A Container</button>


<p>Step 7: See how to use a SQLITE3 database</p>
<span class=note>(For this to work, you MUST create a file called .env at the project root, and it must have the following line in it: "DB_FILE=./data/containers.db")</span>
<br/>
<button on:click={() => {goto('/fromDB')}}>Use Database</button>


<p>Step 8: See how to create Svelte components</p>
<span class=note>(uses db, so create the .env file as above)</span>
<br/>
<button on:click={() => {goto('/fromDBandComponents')}}>Use Components</button>


<style>
.note {
Expand Down
24 changes: 0 additions & 24 deletions src/routes/fromDB/+page.server.js

This file was deleted.

31 changes: 0 additions & 31 deletions src/routes/fromDB/+page.svelte

This file was deleted.

24 changes: 0 additions & 24 deletions src/routes/fromDBandComponents/+page.server.js

This file was deleted.

19 changes: 0 additions & 19 deletions src/routes/fromDBandComponents/+page.svelte

This file was deleted.

4 changes: 2 additions & 2 deletions src/routes/fromapi_mui/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
</Row>
</Head>
<Body>
{#each data.containers as container (container.id)}
{#each data.containers as container (container.containerNumber)}
<Row>
<Cell>{container.id}</Cell>
<Cell>{container.containerNumber}</Cell>
<Cell>{container.nameOfShip}</Cell>
</Row>
{/each}
Expand Down
31 changes: 0 additions & 31 deletions src/routes/fromstatic/+page.svelte

This file was deleted.

0 comments on commit 32be9ad

Please sign in to comment.