Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions examples/postgres-v3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,25 @@

This example shows how to access a PostgreSQL database from Spin component.

## Prerequisite: Postgres

This example assumes postgres is running and accessible locally via its standard 5432 port.

We suggest running the `postgres` Docker container which has the necessary postgres user permissions
already configured. For example:

```
docker run --rm -h 127.0.0.1 -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust postgres
```

## Spin up

From example root:
Then, run the following from the root of this example:

```
createdb spin_dev
psql -d spin_dev -f db/testdata.sql
RUST_LOG=spin=trace spin build --up
createdb -h localhost -U postgres spin_dev
psql -h localhost -U postgres -d spin_dev -f db/testdata.sql
spin build --up
```

Curl the read route:
Expand Down
19 changes: 15 additions & 4 deletions examples/postgres/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,25 @@

This example shows how to access a PostgreSQL database from Spin component.

## Prerequisite: Postgres

This example assumes postgres is running and accessible locally via its standard 5432 port.

We suggest running the `postgres` Docker container which has the necessary postgres user permissions
already configured. For example:

```
docker run --rm -h 127.0.0.1 -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust postgres
```

## Spin up

From example root:
Then, run the following from the root of this example:

```
createdb spin_dev
psql -d spin_dev -f db/testdata.sql
RUST_LOG=spin=trace spin build --up
createdb -h localhost -U postgres spin_dev
psql -h localhost -U postgres -d spin_dev -f db/testdata.sql
spin build --up
```

Curl the read route:
Expand Down
Loading