Initial commit
65
+page.server.ts
Normal file
@ -0,0 +1,65 @@
|
||||
import type { Actions, Load } from '@sveltejs/kit';
|
||||
import { Recipe } from '../../../models/Recipe';
|
||||
import { dbConnect, dbDisconnect } from '../../../utils/db';
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
|
||||
export const load: Load = async () => {
|
||||
await dbConnect();
|
||||
let todos = await Recipe.find().lean();
|
||||
await dbDisconnect();
|
||||
todos = JSON.parse(JSON.stringify(todos));
|
||||
todos = todos.reverse();
|
||||
return {
|
||||
todos,
|
||||
};
|
||||
};
|
||||
|
||||
export const actions: Actions = {
|
||||
create: async ({ request }) => {
|
||||
const formData = await request.formData();
|
||||
const todoName = formData.get('todoName');
|
||||
|
||||
const newTodo = {
|
||||
title: todoName,
|
||||
isDone: false,
|
||||
};
|
||||
|
||||
await dbConnect();
|
||||
await Recipe.create(newTodo);
|
||||
await dbDisconnect();
|
||||
|
||||
console.log('New todo added: ', newTodo);
|
||||
return {
|
||||
success: true,
|
||||
};
|
||||
},
|
||||
update: async ({ request }) => {
|
||||
const formData = await request.formData();
|
||||
const todoId = formData.get('todoId');
|
||||
const todoName = formData.get('todoName');
|
||||
await dbConnect();
|
||||
await Recipe.findByIdAndUpdate(todoId, {
|
||||
title: todoName,
|
||||
}).lean();
|
||||
await dbDisconnect();
|
||||
|
||||
console.log('Todo updated: ', todoId);
|
||||
|
||||
return {
|
||||
success: true,
|
||||
};
|
||||
},
|
||||
|
||||
delete: async ({ request }) => {
|
||||
const formData = await request.formData();
|
||||
const todoId = formData.get('todoId');
|
||||
await dbConnect();
|
||||
await Recipe.findByIdAndDelete(todoId);
|
||||
await dbDisconnect();
|
||||
|
||||
console.log('Todo deleted: ', todoId);
|
||||
return {
|
||||
success: true,
|
||||
};
|
||||
},
|
||||
};
|
10
.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/build
|
||||
/.svelte-kit
|
||||
/package
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
38
README.md
Normal file
@ -0,0 +1,38 @@
|
||||
# create-svelte
|
||||
|
||||
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).
|
||||
|
||||
## Creating a project
|
||||
|
||||
If you're seeing this, you've probably already done this step. Congrats!
|
||||
|
||||
```bash
|
||||
# create a new project in the current directory
|
||||
npm create svelte@latest
|
||||
|
||||
# create a new project in my-app
|
||||
npm create svelte@latest my-app
|
||||
```
|
||||
|
||||
## Developing
|
||||
|
||||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
|
||||
# or start the server and open the app in a new browser tab
|
||||
npm run dev -- --open
|
||||
```
|
||||
|
||||
## Building
|
||||
|
||||
To create a production version of your app:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
You can preview the production build with `npm run preview`.
|
||||
|
||||
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
|
BIN
lib/images/aelplermagronen.webp
Normal file
After Width: | Height: | Size: 209 KiB |
BIN
lib/images/aglio_e_olio.webp
Normal file
After Width: | Height: | Size: 229 KiB |
BIN
lib/images/ajitama.webp
Normal file
After Width: | Height: | Size: 190 KiB |
BIN
lib/images/al_ragu.webp
Normal file
After Width: | Height: | Size: 502 KiB |
BIN
lib/images/anisbrot.webp
Normal file
After Width: | Height: | Size: 388 KiB |
BIN
lib/images/annaomelette.webp
Normal file
After Width: | Height: | Size: 264 KiB |
BIN
lib/images/apfelkompott.webp
Normal file
After Width: | Height: | Size: 127 KiB |
BIN
lib/images/apfelstrudel.webp
Normal file
After Width: | Height: | Size: 236 KiB |
BIN
lib/images/apfelwaehe.webp
Normal file
After Width: | Height: | Size: 458 KiB |
BIN
lib/images/aprikosenwaehe.webp
Normal file
After Width: | Height: | Size: 439 KiB |
BIN
lib/images/baerlauchravioli.webp
Normal file
After Width: | Height: | Size: 228 KiB |
BIN
lib/images/basler_brunsli.webp
Normal file
After Width: | Height: | Size: 489 KiB |
BIN
lib/images/brezel.webp
Normal file
After Width: | Height: | Size: 300 KiB |
BIN
lib/images/broeseltopfen.webp
Normal file
After Width: | Height: | Size: 122 KiB |
BIN
lib/images/brokkolisuppe.webp
Normal file
After Width: | Height: | Size: 284 KiB |
BIN
lib/images/brotgewuerz.webp
Normal file
After Width: | Height: | Size: 263 KiB |
BIN
lib/images/buchtel_vanillesauce.webp
Normal file
After Width: | Height: | Size: 110 KiB |
BIN
lib/images/buendner_nusstorte.webp
Normal file
After Width: | Height: | Size: 354 KiB |
BIN
lib/images/burger_buns.webp
Normal file
After Width: | Height: | Size: 200 KiB |
BIN
lib/images/carbonara.webp
Normal file
After Width: | Height: | Size: 224 KiB |
BIN
lib/images/chaeschueechli.webp
Normal file
After Width: | Height: | Size: 270 KiB |
BIN
lib/images/checca.webp
Normal file
After Width: | Height: | Size: 312 KiB |
BIN
lib/images/daenische_kardamomkekse.webp
Normal file
After Width: | Height: | Size: 495 KiB |
BIN
lib/images/dinette.webp
Normal file
After Width: | Height: | Size: 270 KiB |
BIN
lib/images/eierschwammerlgoulash.webp
Normal file
After Width: | Height: | Size: 315 KiB |
BIN
lib/images/eingelegte_zwiebel.webp
Normal file
After Width: | Height: | Size: 360 KiB |
BIN
lib/images/erdaepfelgoulasch.webp
Normal file
After Width: | Height: | Size: 408 KiB |
BIN
lib/images/fastenwaehe.webp
Normal file
After Width: | Height: | Size: 289 KiB |
BIN
lib/images/firecracker.webp
Normal file
After Width: | Height: | Size: 236 KiB |
BIN
lib/images/flammkuchen.webp
Normal file
After Width: | Height: | Size: 383 KiB |
BIN
lib/images/frittatensuppe.webp
Normal file
After Width: | Height: | Size: 286 KiB |
BIN
lib/images/germknoedel.webp
Normal file
After Width: | Height: | Size: 300 KiB |
BIN
lib/images/gnocchi.webp
Normal file
After Width: | Height: | Size: 582 KiB |
BIN
lib/images/gratin_dauphinois.webp
Normal file
After Width: | Height: | Size: 326 KiB |
BIN
lib/images/gurkensalat.webp
Normal file
After Width: | Height: | Size: 192 KiB |
BIN
lib/images/hashbrown.webp
Normal file
After Width: | Height: | Size: 329 KiB |
BIN
lib/images/hoernli_mit_gehacktem.webp
Normal file
After Width: | Height: | Size: 260 KiB |
BIN
lib/images/hollondaise.webp
Normal file
After Width: | Height: | Size: 207 KiB |
BIN
lib/images/hollundersirup.webp
Normal file
After Width: | Height: | Size: 176 KiB |
BIN
lib/images/huehnerbouillon.webp
Normal file
After Width: | Height: | Size: 339 KiB |
BIN
lib/images/hummus.webp
Normal file
After Width: | Height: | Size: 127 KiB |
BIN
lib/images/kaesspaetzle.webp
Normal file
After Width: | Height: | Size: 214 KiB |
BIN
lib/images/kaiserschmarrn.webp
Normal file
After Width: | Height: | Size: 326 KiB |
BIN
lib/images/karottensalat.webp
Normal file
After Width: | Height: | Size: 188 KiB |
BIN
lib/images/kartoffelsalat.webp
Normal file
After Width: | Height: | Size: 246 KiB |
BIN
lib/images/kasnudeln.webp
Normal file
After Width: | Height: | Size: 162 KiB |
BIN
lib/images/kirschwaehe.webp
Normal file
After Width: | Height: | Size: 511 KiB |
BIN
lib/images/kletzennudel.webp
Normal file
After Width: | Height: | Size: 283 KiB |
BIN
lib/images/knoblauchbrot.webp
Normal file
After Width: | Height: | Size: 395 KiB |
BIN
lib/images/knochensuppe.webp
Normal file
After Width: | Height: | Size: 135 KiB |
BIN
lib/images/kokosbusserl.webp
Normal file
After Width: | Height: | Size: 231 KiB |
BIN
lib/images/kottbullar.webp
Normal file
After Width: | Height: | Size: 288 KiB |
BIN
lib/images/kraftbruehe.webp
Normal file
After Width: | Height: | Size: 93 KiB |
BIN
lib/images/kuerbiscremesuppe.webp
Normal file
After Width: | Height: | Size: 224 KiB |
BIN
lib/images/kuerbisnudeln.webp
Normal file
After Width: | Height: | Size: 625 KiB |
BIN
lib/images/lauch_dinette.webp
Normal file
After Width: | Height: | Size: 204 KiB |
BIN
lib/images/lauchquiche.webp
Normal file
After Width: | Height: | Size: 287 KiB |
BIN
lib/images/linsen_curry.webp
Normal file
After Width: | Height: | Size: 300 KiB |
12
lib/images/load_html.js
Normal file
@ -0,0 +1,12 @@
|
||||
document.querySelectorAll('.url_insert').forEach(url_insert);
|
||||
function url_insert(el) {
|
||||
var url = el.dataset.url;
|
||||
var xhttp = new XMLHttpRequest();
|
||||
xhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
el.innerHTML = this.response;
|
||||
}
|
||||
};
|
||||
xhttp.open("GET", url, true);
|
||||
xhttp.send();
|
||||
}
|
BIN
lib/images/marillenknoedel.webp
Normal file
After Width: | Height: | Size: 230 KiB |
BIN
lib/images/maronisuppe.webp
Normal file
After Width: | Height: | Size: 315 KiB |
BIN
lib/images/masalachai.webp
Normal file
After Width: | Height: | Size: 145 KiB |
BIN
lib/images/mayonnaise.webp
Normal file
After Width: | Height: | Size: 144 KiB |
BIN
lib/images/miso_steak_aubergine.webp
Normal file
After Width: | Height: | Size: 226 KiB |
BIN
lib/images/mousse_au_chocolat.webp
Normal file
After Width: | Height: | Size: 275 KiB |
BIN
lib/images/ofen_pommes_frites.webp
Normal file
After Width: | Height: | Size: 461 KiB |
BIN
lib/images/orecchiette.webp
Normal file
After Width: | Height: | Size: 180 KiB |
BIN
lib/images/orecchiette_al_pomodoro.webp
Normal file
After Width: | Height: | Size: 295 KiB |
BIN
lib/images/osterkuchen.webp
Normal file
After Width: | Height: | Size: 452 KiB |
30
lib/images/osterkuchen_osterlamm_schablone.svg
Normal file
After Width: | Height: | Size: 45 KiB |
BIN
lib/images/osterlamm.webp
Normal file
After Width: | Height: | Size: 266 KiB |
BIN
lib/images/palatschinken.webp
Normal file
After Width: | Height: | Size: 326 KiB |
BIN
lib/images/petersilkartoffeln.webp
Normal file
After Width: | Height: | Size: 167 KiB |
BIN
lib/images/pfeffermaenner.webp
Normal file
After Width: | Height: | Size: 220 KiB |
BIN
lib/images/pilze.webp
Normal file
After Width: | Height: | Size: 220 KiB |
BIN
lib/images/pilzrahmsauce.webp
Normal file
After Width: | Height: | Size: 270 KiB |
BIN
lib/images/pizokel.webp
Normal file
After Width: | Height: | Size: 419 KiB |
BIN
lib/images/pizza_chorizo.webp
Normal file
After Width: | Height: | Size: 331 KiB |
BIN
lib/images/pizza_veggie.webp
Normal file
After Width: | Height: | Size: 258 KiB |
BIN
lib/images/plunderteig.webp
Normal file
After Width: | Height: | Size: 236 KiB |
BIN
lib/images/poulet_katsu.webp
Normal file
After Width: | Height: | Size: 521 KiB |
BIN
lib/images/pressgurken.webp
Normal file
After Width: | Height: | Size: 360 KiB |
BIN
lib/images/quiche_lorraine.webp
Normal file
After Width: | Height: | Size: 354 KiB |
BIN
lib/images/randen_avocado_roesti.webp
Normal file
After Width: | Height: | Size: 197 KiB |
BIN
lib/images/randensalat.webp
Normal file
After Width: | Height: | Size: 196 KiB |
BIN
lib/images/ratatouille.webp
Normal file
After Width: | Height: | Size: 497 KiB |
BIN
lib/images/reindling.webp
Normal file
After Width: | Height: | Size: 225 KiB |
BIN
lib/images/rhabarberkonfi.webp
Normal file
After Width: | Height: | Size: 330 KiB |
BIN
lib/images/rindsgoulasch.webp
Normal file
After Width: | Height: | Size: 409 KiB |
BIN
lib/images/roesti.webp
Normal file
After Width: | Height: | Size: 58 KiB |
BIN
lib/images/rote_linsen_hummus.webp
Normal file
After Width: | Height: | Size: 372 KiB |
BIN
lib/images/rotkraut.webp
Normal file
After Width: | Height: | Size: 251 KiB |
BIN
lib/images/ruchbrot.webp
Normal file
After Width: | Height: | Size: 162 KiB |
BIN
lib/images/rustikal.webp
Normal file
After Width: | Height: | Size: 645 KiB |
BIN
lib/images/sachertorte.webp
Normal file
After Width: | Height: | Size: 79 KiB |
BIN
lib/images/salbei_spaghetti.webp
Normal file
After Width: | Height: | Size: 217 KiB |