Closed hychen closed 11 years ago
我知道你遇到的問題了:一般 db user 無法 create extension plv8
所以先這樣:
sudo su postgres -c 'psql MYDB'
MYDB> create extension plv8
然後:
pgrest --db tcp://user:pass@localhost/MYDB
應該就可以了。
updated the pgrest recipe, it installs pgextwlist and allows plv8 extension created by non-superusers. try again.
the result after 'vagrant destroy ; vagrant up'
sudo su postgres -c 'createdb MYDB'
sudo su postgres -c 'psql MYDB'
MYDB> create extension plv8
sudo npm i plv8x -g
sudo su postgres -c "plv8x --db tcp://localhost/MYDB --import pgrest:./package.json
error: password authentication failed for user "postgres"
can you create a normal dbuser? nod-pg has a bug using unix socket for connecting db
ok
Best regards, Hsin Yi Chen
More about me: http://about.me/hychen
2013/6/13 Chia-liang Kao notifications@github.com
can you create a normal dbuser? nod-pg has a bug using unix socket for connecting db
— Reply to this email directly or view it on GitHubhttps://github.com/g0v/kuansim/issues/13#issuecomment-19376056 .
vagrant@vagrant-ubuntu-precise-64:/vagrant$ sudo su postgres -c 'createdb MYDB' vagrant@vagrant-ubuntu-precise-64:/vagrant$ sudo su postgres -c 'psql MYDB' MYDB> create extension plv8 vagrant@vagrant-ubuntu-precise-64:/vagrant$ sudo su postgres -c "plv8x --db tcp://postgres:hackg0v@localhost/MYDB --import pgrest:./package.json" vagrant@vagrant-ubuntu-precise-64:/vagrant$ sudo su postgres -c "plv8x --db tcp://postgres:hackg0v@localhost/MYDB --inject 'plv8x_json pgrest_select(plv8x_json)=pgrest:pgrest_select'"
/usr/lib/node_modules/plv8x/node_modules/tmp/lib/tmp.js:260
throw err;
^
error: type plv8x_json does not exist
at Connection.parseE (/usr/lib/node_modules/plv8x/node_modules/pg/lib/connection.js:537:11)
at Connection.parseMessage (/usr/lib/node_modules/plv8x/node_modules/pg/lib/connection.js:382:17)
at Socket.
but the web server works bug the data is empty.
sudo su postgres -c "pgrest --db tcp://postgres:hackg0v@localhost/MYDB"
Serving tcp://postgres:hackg0v@localhost/MYDB
on http://localhost:3000/collections
$script = <<SCRIPT sudo su postgres -c 'createdb MYDB' sudo su postgres -c "psql MYDB -c 'create extension plv8'" sudo npm i pgrest -g sudo su postgres -c "pgrest --db tcp://postgres:hackg0v@localhost/MYDB" & SCRIPT
目標 架設restful db