1
0
mirror of https://github.com/actix/examples synced 2024-11-27 16:02:57 +01:00
examples/async_pg
2020-01-16 06:46:28 -05:00
..
sql added async_pg example 2020-01-15 19:19:15 -05:00
src fixed formatting for async_pg 2020-01-16 06:46:28 -05:00
.gitignore added async_pg example 2020-01-15 19:19:15 -05:00
Cargo.toml added async_pg example 2020-01-15 19:19:15 -05:00
README.md added async_pg example 2020-01-15 19:19:15 -05:00

This example illustrates:

  • tokio_postgres
  • use of tokio_pg_mapper for postgres data mapping
  • deadpool_postgres for connection pooling

Instructions

  1. Set up the testing database by running /sql/create_db.sh
  2. cargo run
  3. from the command line (linux), POST a user to the endpoint: echo '{"email": "ferris@thecrab.com", "first_name": "ferris", "last_name": "crab", "username": "ferreal"}' | http -f --json --print h POST http://127.0.0.1:8080/users
    • a unique constraint exists for username, so running this twice will return a 500