1
0
mirror of https://github.com/actix/examples synced 2024-11-27 16:02:57 +01:00
examples/async_db
Arve Seljebu 78a753a06a
update rusqlite and r2d2_sqlite in async_db and r2d2 (#148)
* upgrade rusqlite to 0.18

* add note about async_db blocking and running in thread pool

* idiomatic async_db

- DRY
- Iterator::collect + return type
- note about why we are sleeping

* remove r2d2/test.db
2020-01-30 15:52:10 +09:00
..
db Fix bug in database script 2019-05-24 20:34:08 +02:00
src update rusqlite and r2d2_sqlite in async_db and r2d2 (#148) 2020-01-30 15:52:10 +09:00
Cargo.toml update rusqlite and r2d2_sqlite in async_db and r2d2 (#148) 2020-01-30 15:52:10 +09:00
README.md Remove serde_derive https://github.com/serde-rs/serde/issues/1441#issuecomment-445481084 2020-01-12 14:04:02 +01: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