CentOS 6.9/7安装Parse+PostgreSQL

一、安装Parse-Server

# npm install -g parse-server --unsafe-perm

备注:用--unsafe-perm参数的目的是使用了root权限进行安装。

二、启动Parse并测试

// 修改数据库支持只用用户名登录
# vi /var/lib/pgsql/10/data/pg_hba.conf
// 在最后找到这样host all all 127.0.0.1/32 ident
// 改为host all all 127.0.0.1/32 trust
// 重新读取配置文件
# service postgresql-10 reload
// 启动parse
# parse-server --appId APPLICATION_ID --masterKey MASTER_KEY --restAPIKey RESTAPI_KEY --databaseURI postgres://postgres@127.0.0.1:5432/postgres
// 使用curl测试,正常返回即可
# curl -X POST -H "X-Parse-Application-Id: APPLICATION_ID" -H "X-Parse-REST-API-Key: RESTAPI_KEY" -H "Content-Type: application/json" -d '{"score":1337,"playerName":"Sean Plott","cheatMode":false}' http://localhost:1337/parse/classes/GameScore

备注:数据库使用的是PostgreSQL

参考:

https://stackoverflow.com/questions/29468404/gyp-warn-eacces-user-root-does-not-have-permission-to-access-the-dev-dir(安装报错的解决方法)

https://www.cnblogs.com/jaxu/p/5864134.html(安装报错的解决方法)

http://docs.parseplatform.org/parse-server/guide/(官网)

http://docs.parseplatform.org/rest/guide/(官网API)

https://github.com/parse-community/parse-server

原文地址:https://www.cnblogs.com/EasonJim/p/9023914.html