Tagged Questions
43
votes
3answers
52k views
What is this Javascript “require”?
I'm trying to get Javascript to read/write to a PostgreSQL database. I found this project on github. I was able to get the following sample code to run in node.
var pg = require('pg'); //native libpq ...
34
votes
3answers
41k views
Play with Postgres through Node.js
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 ...
4
votes
4answers
2k views
Return id if a row exists, INSERT otherwise
I'm writing a function in node.js to query a PostgreSQL table.
If the row exists, I want to return the id column from the row.
If it doesn't exist, I want to insert it and return the id (insert into ...
0
votes
1answer
198 views
Admin panel for postgresql on Node.js server
I want to host a Node project running with a postgreSQL db. However, when it is on the server I won't have a UI tool to easily view database entries. Does anyone know how I would go about creating a ...
31
votes
7answers
14k views
Any Postgres compatible ORM for Node.js?
I'm seeking for a good ORM for postgres under Node.js, one that supports declaration of relationships beetween models, and fields validation. I've searched during a long time and cannot get any ...
12
votes
2answers
8k views
Postgres Hstore vs. Redis - performance wise
I read about HStores in Postgres something that is offered by Redis as well.
Our application is written in NodeJS. Two questions:
Performance-wise, is Postgres HStore comparable to Redis?
for ...
10
votes
1answer
8k views
Mongodb vs Postgres in a Nodejs App [closed]
I'm building a nodejs application and am utterly torn between nosql mongodb vs rmds PostregresSql. My project is to create a open source example project for logging visitors and displaying visitor ...
4
votes
2answers
1k views
LISTEN query timeout with node-postgres?
I have an "article" table on a Postgresql 9.1 database and a trigger that notifies a channel on each insert.
I'd like to create a node.js script that catches those inserts and pushes notifications to ...
3
votes
3answers
2k views
Trying to connect my node.js to Heroku PostgreSQL database. Following Heroku Postgres tutorial
I'm following these two Heroku tutorials:
https://devcenter.heroku.com/articles/getting-started-with-nodejs
and
https://devcenter.heroku.com/articles/heroku-postgresql
I have the 'hello world' ...
7
votes
3answers
4k views
Issue installing node-postgres with npm (on windows)
I am trying to install pg on windows using npm, but receive the following error:
c:\Users\someone\Dropbox\somefolder>npm install -g pg
npm http GET https://registry.npmjs.org/pg
npm http 304 ...
4
votes
4answers
19k views
How to set node path for nodejs (Ubuntu)
I'm trying to setup nodejs to access a postgres database. What I've done so far is the following (https://gist.github.com/579814):
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ...
2
votes
1answer
515 views
Testing database related code in NodeJS
Using PostgreSQL.
I'm trying to set up a proper test suite for an API. So far it works but the tests are done on the main database directly. I then have to remove everything my tests created, or ...
2
votes
2answers
3k views
Upsert in Postgres using node.js
I'm trying to do an insert or update in a postgres database using node.js with pg extension (version 0.5.4).
So far I have this code:
(...)
client.query({
text: "update users set ...
1
vote
2answers
112 views
Login details security using salt n hash and a login role in postgresql
I am coding up the security for a website in express.js and postgresql db. Now I have been reading about salting and hashing and I have the code set up with pdkdf2 using the crypto module, but my ...
0
votes
1answer
61 views
Node.js, PostgreSQL error: no pg_hba.conf entry for host
I am following this article ((http://nodeexamples.com/2012/09/21/connecting-to-a-postgresql-database-from-node-js-using-the-pg-module/). I have already deployed my app to heroku and currently using ...
0
votes
1answer
56 views
Updating multiple records using sequelize and nodejs?
Using node.js (v0.10.12) and sequelize (2.0.0-dev9), I am wanting to update attributes within an existing database table. From anther SO discussion I am able to update only one record at a time. I ...
0
votes
1answer
223 views
Node.js app becomes unresponsive if I reload multiple times in quick succession
I'm developing a node.js app that displays a single page with map data (which will eventually be updated using an .ajax call).
Right now, my code looks like this:
app.get('/', function(req, ...
0
votes
1answer
833 views
Can I use PostgreSQL (pg) in the client-side (express/node.js)
I want to use PostgreSQL in the client side. is that possible? can i have this code?
in my server.js
var pg = require('pg');
in my client side
var conString = ...