環(huán)境要求
Node
React Native :iOS和Android的配置環(huán)境。React Native環(huán)境搭建
MongoDB Mac上安裝MongoDB 如果你想運(yùn)行IOS的Demo的話垒棋,還需要:Xcode 7.3+ 酗失、CocoaPods:ios項(xiàng)目的包管理工具
運(yùn)行Android項(xiàng)目的話蛛淋,需要:Gradle、Android SDK
初始化項(xiàng)目
下載源代碼:
git clone git@github.com:fbsamples/f8app.git
cd f8app
安裝項(xiàng)目依賴:
npm install
ios 依賴
cd ios
pod update
android依賴
cd ../android
gradle build
使用測(cè)試數(shù)據(jù)
啟動(dòng)MongoDB:
mongod –config /usr/local/etc/mongod.conf
測(cè)試MongoDB是否啟動(dòng)成功:
mongo
MongoDB shell version: 3.2.6
就是MongoDB啟動(dòng)成功了。 啟動(dòng)Parse/GraphQL的服務(wù):
npm start
導(dǎo)入測(cè)試數(shù)據(jù):
npm run import-data 確認(rèn)下面的地址是可以訪問(wèn)的央碟,并且是有數(shù)據(jù)的撰糠。
Parse Dashboard: http://localhost:8080/dashboard
Graph/QL: http://localhost:8080/graphql
運(yùn)行
在mac下測(cè)試 卡在Mongoldb很長(zhǎng)時(shí)間板壮,一啟動(dòng)就報(bào)錯(cuò):
2016-07-15T02:02:22.111Z - Uncaught internal
server error. { [MongoError: getaddrinfo ENOTFOUND
example-mongo-hosting.com example-mongo-
hosting.com:1337]
name: 'MongoError',
message: 'getaddrinfo ENOTFOUND example-mongo-
hosting.com example-mongo-hosting.com:1337' } Error:
getaddrinfo ENOTFOUND example-mongo-hosting.com
example-mongo-hosting.com:1337
at errnoException (dns.js:26:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:77:26)
后來(lái)發(fā)現(xiàn)需要安裝:
npm install -g parse-server
再次運(yùn)行Mongodb數(shù)據(jù)導(dǎo)入正常夺巩,app可正常運(yùn)行