I find myself trying to create a postgres database, so I installed postgres and started a server with initdb /usr/local/pgsql/data
, then I started that instance with postgres -D /usr/local/pgsql/data
now how can I interact with this through node? For example, what would the connectionstring
be, or how am I able to find out what it is.
Tell me more
×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
I never used node.js, but my favorit search engine told me: https://github.com/brianc/node-postgres | |||
|
Here is an example I used to connect node.js to my Postgres database. The interface in node.js that I used can be found here https://github.com/brianc/node-postgres
| |||||||||||||||||||||
|
Just to add a different option - I use Node-DBI to connect to PG, but also due to the ability to talk to MySQL and sqlite. Node-DBI also includes functionality to build a select statement, which is handy for doing dynamic stuff on the fly. Quick sample (using config information stored in another file):
config.js:
| |||
|