This repository contains the project code for Part II of the workshop. On this readme, you can find all information necessary to work the hands-on exercise of Part II.
- Svelte Documentation
- SvelteKit Documentation
- Available Lucide Icons
- Pico (CSS) Documentation
- Zod Documentation
- zod-form-data Documentation
- TypeORM Documentation
First things first, you need to clone this repository to your local machine. After that, you first can install dependencies and then initialize the environment variables. After that it should be possible to run the dev server,
If you prefer to work in a sandboxed browser environment, you can open the repository in StackBlitz, instead. Everything should work the same.
# clone the repo
git clone https://github.com/nilsroehrig/full-stack-svelte-part-2.git
# in repository folder, checkout exercise starting point
git checkout exercise
# install deps
npm ci
# initialize env
node init.js
# run dev server
npm run devThe dev server is available at localhost:5173.
- Add a new page at
/events/createthat contains a form to create a new event. - The page should contain a form to enter all necessary information for an event. See the
Evententity in theserver/src/entitiesfolder for reference. - The page should define a form action that processes the form data and creates a new event in the database. Use zod-form-data to validate the form data.
- The new page should be accessible via the navigation bar.
- Add a new page at
/events/[id]that accepts an event as a prop and displays the details of said event. This should include the name of the owner and the number of participants as well. - The page should display wether the current user is the owner of the event.
- The page should define a server load function that fetches the event with id [id], as well as its related data from the database.
- Clicking on an event in the events list should navigate to the event details page.
- On the event details page, add a button to participate in the event.
- If the user is already participating in the event, the button should instead allow the user to leave the event.
- The page should define form actions to handle the participation and leaving of events.
- Add a new page at
/events/[id]/editthat accepts an event as a prop and contains a form to edit said event. - The page should define a server load function that fetches the event with id [id] from the database.
- The page should define a form action that processes the form data and updates the event in the database.
- It should not be possible to edit events of which the user is not the owner.
- The page should be accessible via the event details page.
- On the event details page, add the option to delete the event.
- The page should define a form action that deletes the event from the database.
- It should not be possible to delete events of which the user is not the owner.
- On the startpage, add a new section that displays all events the user is participating in.
- Add a new page at
/eventsthat displays all events in the database. - The page should define a server load function that fetches all events from the database ordered by date. The
orderoption of any repository find method can be used to achieve this. - The new page should be accessible via the navigation bar.