Skip to content

Help connecting to Postgres Container #240

Answered by cristianrgreco
alexlin51 asked this question in Q&A
Discussion options

You must be logged in to vote

@alexlin51 I've just published a PostgreSQL module to make this easier for everyone, it's available in 7.17.0.

README is here, which includes links to examples: https://github.com/testcontainers/testcontainers-node/tree/master/src/modules/postgresql.

Using it is as simple as:

import { PostgreSqlContainer } from "testcontainers";

const container = await new PostgreSqlContainer().start();

(See the examples for further customisation options, such as setting the database/username/password).

Hope that helps 🙂

Replies: 2 comments 1 reply

This comment has been hidden.

Comment options

You must be logged in to vote
1 reply
@alexlin51
Comment options

Answer selected by alexlin51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants