Learning Svelete - Day 3 - [click to go back]

day three:

so i already learned the basics of svelte, so i think i'll want to get more creative.

i decided to make the music page exist. you can see that here, but if you view this later on it might be modified.

let's break this down

first of all, for data i'm using mongodb + mongoose. the website now has a lib folder with a handful of utilities, and they are orginized like this:

then i wrote the api route that has music data, which is a SvelteKit endpoint, which basically wraps the mongoose find method.

since the data structure include a Map and a Date object, i wrote a small class on the client side which wraps the JSON data and adds back the fancier types. this just improves the developer experience.

if you would like to play around with the data, i made Artifact and MusicArtifact classes available in the development console, and if the data is visible above, that is available in the music variable.

i apologize for the delay in todays post

© dave caruso 2021. all rights reserved.