File tree Expand file tree Collapse file tree 2 files changed +30
-8
lines changed Expand file tree Collapse file tree 2 files changed +30
-8
lines changed Original file line number Diff line number Diff line change 22
33This example shows how to access a PostgreSQL database from Spin component.
44
5+ ## Prerequisite: Postgres
6+
7+ This example assumes postgres is running and accessible locally via its standard 5432 port.
8+
9+ We suggest running the ` postgres ` Docker container which has the necessary postgres user permissions
10+ already configured. For example:
11+
12+ ```
13+ docker run --rm -h 127.0.0.1 -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust postgres
14+ ```
15+
516## Spin up
617
7- From example root:
18+ Then, run the following from the root of this example :
819
920```
10- createdb spin_dev
11- psql -d spin_dev -f db/testdata.sql
12- RUST_LOG=spin=trace spin build --up
21+ createdb -h localhost -U postgres spin_dev
22+ psql -h localhost -U postgres - d spin_dev -f db/testdata.sql
23+ spin build --up
1324```
1425
1526Curl the read route:
Original file line number Diff line number Diff line change 22
33This example shows how to access a PostgreSQL database from Spin component.
44
5+ ## Prerequisite: Postgres
6+
7+ This example assumes postgres is running and accessible locally via its standard 5432 port.
8+
9+ We suggest running the ` postgres ` Docker container which has the necessary postgres user permissions
10+ already configured. For example:
11+
12+ ```
13+ docker run --rm -h 127.0.0.1 -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust postgres
14+ ```
15+
516## Spin up
617
7- From example root:
18+ Then, run the following from the root of this example :
819
920```
10- createdb spin_dev
11- psql -d spin_dev -f db/testdata.sql
12- RUST_LOG=spin=trace spin build --up
21+ createdb -h localhost -U postgres spin_dev
22+ psql -h localhost -U postgres - d spin_dev -f db/testdata.sql
23+ spin build --up
1324```
1425
1526Curl the read route:
You can’t perform that action at this time.
0 commit comments