From the course: Full-Stack Web Applications with Rust and Leptos
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
SQLx and SQLite setup
From the course: Full-Stack Web Applications with Rust and Leptos
SQLx and SQLite setup
- [Instructor] In previous videos, we saw how to create server functions that can be invoked directly from our application's front end logic. But right now our server functions just return mock responses. We need to replace the mock data with logic that actually reads and writes to and from a database. In this video, we're going to replace these mock responses with some simple logic that reads and writes to a SQLite database. The nice thing about SQLite is that your application doesn't actually need to connect to a separate database server. All the data is written to a file stored on the disc that your application is running on. Even for applications that will eventually need a full blown database, using SQLite in the early stages can be nice because you can defer that extra dependency and iterate more quickly. One of the most popular Rust crates for interacting with SQL databases, including SQLite, is called SQLX. It provides a means of setting up your database schema and then having…