SvelteKit 1 With SQLite Displaying Changing and Searching Data
SvelteKit 1 With SQLite: Displaying, Changing and Searching Data
Metadata
- Author: [[Philipp
Hartenfeller]]
- Full Title: SvelteKit 1 With SQLite: Displaying, Changing and Searching Data
- Category: #articles
- Summary: SvelteKit and SQLite are a great combo as they are both lightweight and easy to use, making it simple to build high-performance, data-driven web applications.
- URL: https://hartenfeller.dev/blog/sveltekit-with-sqlite
Highlights
- export function getInitialTracks(limit = 50): Track[] {
const sql =select t.TrackId as trackId , t.Name as trackName , a.AlbumId as albumId , a.Title as albumTitle , at.ArtistId as artistId , at.Name as artistName , g.Name as genre from tracks t join albums a on t.AlbumId = a.AlbumId join artists at on a.ArtistId = at.ArtistId join genres g on t.GenreId = g.GenreId limit $limit
;
const stmnt = db.prepare(sql);
const rows = stmnt.all({ limit });
return rows as Track[];
} (View Highlight)