web开发 之 搭建基于Parse数据存储服务

目录

  • Parse是什么

  • 准备条件

  • parse-server

  • parse-dashboard

Parse是什么

Parse是BaaS(Backend as a Service)的先驱, 为什么说是先驱呢?

因为Parse在被Facebook收购之后, 于2016年1月已经关闭服务

还好, Facebook作为一个良心企业, 将Parse Server及其相关组件都开源了 [github地址]

对于一些项目来说, Parse Server完全可以满足后端的需求, 且不用写任何一行代码!

现在有哪些主流的BaaS提供商, 国外的Firebase, 国内的代表LeanCloud

准备条件

安装node以及npm

详细参考Node.js官网

安装mongodb

brew install mongodb

启动mongodb服务

mongod --config /usr/local/etc/mongod.conf

安装robomongo

robomongo is a native MongoDB management tool (Admin UI) [这里下载]

parse-server

安装parse-server

npm install -g parse-server

启动parse-server服务

parse-server --appId APPLICATION_ID --masterKey MASTER_KEY --databaseURI mongodb://localhost/parse

验证parse-server服务

curl -X POST \
-H "X-Parse-Application-Id: APPLICATION_ID" \
-H "Content-Type: application/json" \
-d '{"score":1337,"playerName":"Sean Plott","cheatMode":false}' \
http://localhost:1337/parse/classes/GameScore

如果parse-server启动成功, 上述命令执行的终端输出是

{"objectId":"wuEFLRoaiF","createdAt":"2016-08-31T09:26:57.281Z"}

同时, 我们打开robomongo可以看到一条新数据如下

web开发 之 搭建基于Parse数据存储服务_第1张图片
web-parse_01.png

parse-dashboard

安装parse-dashboard

parse-dashboard is a standalone dashboard for managing your Parse apps

npm install -g parse-dashboard

启动parse-dashboard服务

parse-dashboard --appId APPLICATION_ID --masterKey MASTER_KEY --serverURL "http://localhost:1337/parse" --appName ParseDemo

使用浏览器打开: http://localhost:4040/

web开发 之 搭建基于Parse数据存储服务_第2张图片
web-parse_02.png

接下来, Parse的世界, 就由你自己来探索吧!

更多文章, 请支持我的个人博客

你可能感兴趣的:(web开发 之 搭建基于Parse数据存储服务)