Skip to content

Commit

Permalink
Merge branch 'main' of github.com:deeper-x/actix-pg-template
Browse files Browse the repository at this point in the history
  • Loading branch information
deeper-x committed Aug 9, 2024
2 parents 85c298e + 28e8245 commit 2f16a3c
Showing 1 changed file with 1 addition and 43 deletions.
44 changes: 1 addition & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,54 +8,12 @@
- `deadpool_postgres` for connection pooling
- `dotenv` + `config` for configuration

## Instructions

### NOTE:

1. Create database user
```sql
CREATE USER test_user WITH PASSWORD 'testing';
```

2. Create database
An alternative using SQL:
```sql
CREATE DATABASE testing_db OWNER test_user;
```

3. Initialize database

```shell
psql -f sql/schema.sql testing_db
```

4. Grant privileges to new user

```sql
GRANT ALL PRIVILEGES ON SCHEMA testing_db TO test_user;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA testing_db TO test_user;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA testing_db TO test_user;
```

5. Create `.env` file:

```ini
SERVER_ADDR=127.0.0.1:8080
PG__USER=test_user
PG__PASSWORD=testing
PG__HOST=127.0.0.1
PG__PORT=5432
PG__DBNAME=testing_db
PG__POOL_MAX_SIZE=16
```

6. Run the server:

```shell
cargo run
```

7. Using a different terminal send an HTTP POST request to the running server:
Using a different terminal send an HTTP POST request to the running server:

Send a ping:
```shell
Expand Down

0 comments on commit 2f16a3c

Please sign in to comment.