1
0
mirror of https://github.com/actix/examples synced 2024-12-18 00:13:57 +01:00
examples/database_interactions/basic
2022-02-02 01:45:20 +00:00
..
db Restructure folders (#411) 2021-02-26 00:57:58 +00:00
src Update db/basic, db/sqlx_todo and db/r2d2 to v4 (#506) 2022-01-29 16:25:46 +00:00
Cargo.toml all versions are 1.0 2022-02-02 01:45:20 +00:00
README.md Restructure folders (#411) 2021-02-26 00:57:58 +00:00

Getting started using databases with Actix web, asynchronously.

Usage

init database sqlite

From the root directory of this project:

bash db/setup_db.sh

This creates a sqlite database, weather.db, in the root.

server

# if ubuntu : sudo apt-get install libsqlite3-dev
# if fedora : sudo dnf install libsqlite3x-devel
cargo run (or ``cargo watch -x run``)
# Started http server: 127.0.0.1:8080

web client

http://127.0.0.1:8080/asyncio_weather

http://127.0.0.1:8080/parallel_weather

sqlite client

# if ubuntu : sudo apt-get install sqlite3
# if fedora : sudo dnf install sqlite3x
sqlite3 weather.db
sqlite> .tables
sqlite> select * from nyc_weather;

Dependencies

On Ubuntu 19.10:

sudo apt install libsqlite3-dev