1
0
Fork 0
No description
Find a file
2022-03-22 22:31:00 +01:00
db Add diesel and example page 2022-03-21 22:37:03 +01:00
migrations Add diesel and example page 2022-03-21 22:37:03 +01:00
src Add Suspend Yew module 2022-03-22 22:31:00 +01:00
.env Add diesel and example page 2022-03-21 22:37:03 +01:00
.gitignore Add diesel and example page 2022-03-21 22:37:03 +01:00
Cargo.lock Add Suspend Yew module 2022-03-22 22:31:00 +01:00
Cargo.toml Add Suspend Yew module 2022-03-22 22:31:00 +01:00
diesel.toml Add diesel and example page 2022-03-21 22:37:03 +01:00
README.md Add diesel and example page 2022-03-21 22:37:03 +01:00

Actix web + Diesel + Yew SSR

Basic complete web application with rust.

Usage

Install SQLite

# on OpenSUSE
sudo zypper install sqlite3-devel libsqlite3-0 sqlite3

# on Ubuntu
sudo apt-get install libsqlite3-dev sqlite3

# on Fedora
sudo dnf install libsqlite3x-devel sqlite3x

# on macOS (using homebrew)
brew install sqlite3

Initialize SQLite Database


# UNIX
cargo install diesel_cli --no-default-features --features sqlite

# IF NOT WORK USE THIS

cargo install diesel_cli --no-default-features --features sqlite-bundled

echo "DATABASE_URL=db/test.db" > .env
diesel migration run

There will now be a database file at ./test.db.

Running Server

cargo run

# Started http server: 127.0.0.1:8080

Explore The SQLite DB

sqlite3 test.db
sqlite> .tables
sqlite> SELECT * FROM users;

Using Other Databases

You can find a complete example of Diesel + PostgreSQL at: https://github.com/TechEmpower/FrameworkBenchmarks/tree/master/frameworks/Rust/actix