tim-tang / hearthstone Goto Github PK
View Code? Open in Web Editor NEWHeartstone server side build with Node.js
License: GNU General Public License v3.0
Heartstone server side build with Node.js
License: GNU General Public License v3.0
Success:
{
"success": 1,
"message": "新账号"
}
or
{
"success": 1,
"message": "已注册"
}
Fail:
{
"success": 0,
"message": "不得超过20个字符"
}
or
{
"success": 0,
"message": "不得包含特殊字符"
}
Success:
{
"success":true,
"version":30,
"cards":
[
{
"card_id":130,
"title":"疯狂的猴子",
"image_url":"http://xxxxx",
"content":"战吼:扔香蕉。",
"abilities":[
{"name":"冲锋"},
{"name":"冻结"}
],
"attack":1,
"health_power":2,
"cost":1,
"rare":“史诗”,
"occupation":“盗贼”,
"race":“鱼人”,
"evaluation":"This card can...",
"update_at":"2013-04-30",
"version":30 #only for server
},
{
"card_id":130,
"title":"疯狂的猴子",
"image_url":"http://xxxxx",
"content":"战吼:扔香蕉。",
"abilities_id":"1,2",
"atk":1,
"hp":2,
"cost":1,
"Rare_id":1,
"class_id":2,
"race_id":3,
"evaluation":"This card can...",
"last_updatetime":"2013-04-30"
},
{
"card_id":130,
"title":"疯狂的猴子",
"image_url":"http://xxxxx",
"content":"战吼:扔香蕉。",
"abilities_id":"1,2",
"atk":1,
"hp":2,
"cost":1,
"Rare_id":1,
"class_id":2,
"race_id":3,
"evaluation":"This card can...",
"last_updatetime":"2013-04-30"
}
]
}
Fail:
{
"success": 0,
"message": "客户端已经是最新版"
}
Success:
{
"success": 1,
"message": "收藏成功"
}
Fail:
{
"success": 0,
"message": "卡片编号不存在"
}
Success:
{
"success": 1,
"message":"成功选择头像"
}
Fail:
{
"success": 0,
"message":"头像编号不存在"
}
Hello,
Is it Hearthstone clone game nodejs version that I can install ?
I already installed node.js and did a tutorial with MongoDB at localhost to prepare myself
It's not an issue but a question :-)
Thanks in advance
This api include the register function.
Use POST, not GET.
Success:
{
"success": 1,
"message": "登陆成功"
}
or
{
"success": 1,
"message": "注册并登陆成功"
}
Fail:
{
"success": 0,
"message": "密码错误"
}
I tried duplicating exactly what one of the travis boxes were doing. I believe this has something to do with the mongoose fixtures being the wrong version.
https://travis-ci.org/tim-tang/hearthstone/builds/15114110
Locally:
bschmeisser@bschmeisser [02:23:38] [~/hear]
-> % git clone --depth=50 --branch=master git://github.com/tim-tang/hearthstone.git tim-tang/hearthstone
Cloning into 'tim-tang/hearthstone'...
remote: Counting objects: 493, done.
remote: Compressing objects: 100% (227/227), done.
remote: Total 493 (delta 267), reused 458 (delta 244)
Receiving objects: 100% (493/493), 608.91 KiB | 0 bytes/s, done.
Resolving deltas: 100% (267/267), done.
Checking connectivity... done.
bschmeisser@bschmeisser [02:23:40] [~/hear]
-> % cd tim-tang/hearthstone
bschmeisser@bschmeisser [02:23:45] [~/hear/tim-tang/hearthstone] [master]
-> % git checkout -qf 621963d0b58f11d85db04b80699085122310160c
bschmeisser@bschmeisser [02:23:52] [~/hear/tim-tang/hearthstone] [621963d]
-> % gl
bschmeisser@bschmeisser [02:23:58] [~/hear/tim-tang/hearthstone] [621963d]
-> % gco master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
bschmeisser@bschmeisser [02:23:59] [~/hear/tim-tang/hearthstone] [master]
-> % gl
bschmeisser@bschmeisser [02:24:01] [~/hear/tim-tang/hearthstone] [master]
-> % node --version
v0.10.26
bschmeisser@bschmeisser [02:24:12] [~/hear/tim-tang/hearthstone] [master]
-> % npm --version
1.4.3
bschmeisser@bschmeisser [02:24:22] [~/hear/tim-tang/hearthstone] [master]
-> % npm install
npm http GET https://registry.npmjs.org/validator
.....
> [email protected] install /Users/bschmeisser/hear/tim-tang/hearthstone/node_modules/mongoose-fixture/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)
CXX(target) Release/obj.target/kerberos/lib/kerberos.o
CXX(target) Release/obj.target/kerberos/lib/worker.o
CC(target) Release/obj.target/kerberos/lib/kerberosgss.o
CC(target) Release/obj.target/kerberos/lib/base64.o
CXX(target) Release/obj.target/kerberos/lib/kerberos_context.o
SOLINK_MODULE(target) Release/kerberos.node
SOLINK_MODULE(target) Release/kerberos.node: Finished
npm http 304 https://registry.npmjs.org/string_decoder
npm http 304 https://registry.npmjs.org/isarray/0.0.1
npm http 304 https://registry.npmjs.org/core-util-is
npm http GET https://registry.npmjs.org/nan
npm http 304 https://registry.npmjs.org/nan
> [email protected] install /Users/bschmeisser/hear/tim-tang/hearthstone/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)
CXX(target) Release/obj.target/kerberos/lib/kerberos.o
CXX(target) Release/obj.target/kerberos/lib/worker.o
CC(target) Release/obj.target/kerberos/lib/kerberosgss.o
CC(target) Release/obj.target/kerberos/lib/base64.o
CXX(target) Release/obj.target/kerberos/lib/kerberos_context.o
SOLINK_MODULE(target) Release/kerberos.node
SOLINK_MODULE(target) Release/kerberos.node: Finished
> [email protected] install /Users/bschmeisser/hear/tim-tang/hearthstone/node_modules/mongoose-fixture/node_modules/mongoose/node_modules/mongodb/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)
CXX(target) Release/obj.target/bson/ext/bson.o
SOLINK_MODULE(target) Release/bson.node
SOLINK_MODULE(target) Release/bson.node: Finished
> [email protected] install /Users/bschmeisser/hear/tim-tang/hearthstone/node_modules/mongoose/node_modules/mongodb/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)
CXX(target) Release/obj.target/bson/ext/bson.o
SOLINK_MODULE(target) Release/bson.node
SOLINK_MODULE(target) Release/bson.node: Finished
[email protected] node_modules/travis-cov
[email protected] node_modules/underscore
[email protected] node_modules/validator
[email protected] node_modules/grunt-contrib-clean
└── [email protected]
[email protected] node_modules/eventproxy
└── [email protected]
[email protected] node_modules/should
[email protected] node_modules/grunt-shell
└── [email protected] ([email protected], [email protected], [email protected])
[email protected] node_modules/express
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
└── [email protected] ([email protected], [email protected])
[email protected] node_modules/mocha
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected])
[email protected] node_modules/grunt-api-benchmark
├── [email protected]
└── [email protected] ([email protected], [email protected])
[email protected] node_modules/grunt-mocha-test
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
[email protected] node_modules/grunt
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected])
└── [email protected] ([email protected], [email protected])
[email protected] node_modules/newrelic
[email protected] node_modules/grunt-docco
└── [email protected] ([email protected], [email protected], [email protected], [email protected])
[email protected] node_modules/blanket
├── [email protected]
├── [email protected] ([email protected])
└── [email protected]
[email protected] node_modules/grunt-contrib-jshint
├── [email protected]
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
[email protected] node_modules/mongoose-fixture
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected]
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
[email protected] node_modules/mongoose
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected], [email protected])
bschmeisser@bschmeisser [02:24:41] [~/hear/tim-tang/hearthstone] [master]
-> % npm install -g grunt-cli
npm http GET https://registry.npmjs.org/grunt-cli
npm http 304 https://registry.npmjs.org/grunt-cli
npm http GET https://registry.npmjs.org/resolve
npm http GET https://registry.npmjs.org/nopt
npm http GET https://registry.npmjs.org/findup-sync
npm http 304 https://registry.npmjs.org/findup-sync
npm http 304 https://registry.npmjs.org/nopt
npm http 304 https://registry.npmjs.org/resolve
npm http GET https://registry.npmjs.org/abbrev
npm http GET https://registry.npmjs.org/glob
npm http GET https://registry.npmjs.org/lodash
npm http 304 https://registry.npmjs.org/abbrev
npm http 304 https://registry.npmjs.org/lodash
npm http 304 https://registry.npmjs.org/glob
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/minimatch
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/minimatch
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/sigmund
npm http 304 https://registry.npmjs.org/lru-cache
npm http 304 https://registry.npmjs.org/sigmund
/usr/local/bin/grunt -> /usr/local/lib/node_modules/grunt-cli/bin/grunt
[email protected] /usr/local/lib/node_modules/grunt-cli
├── [email protected]
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected])
bschmeisser@bschmeisser [02:24:45] [~/hear/tim-tang/hearthstone] [master]
-> % npm test
> [email protected] test /Users/bschmeisser/hear/tim-tang/hearthstone
> grunt
Running "clean:dist" (clean) task
Cleaning docs/public...OK
Cleaning docs/card.html...OK
Cleaning docs/cardHandler.html...OK
Cleaning docs/cardService.html...OK
Cleaning docs/comment.html...OK
Cleaning docs/commentHandler.html...OK
Cleaning docs/commentService.html...OK
Cleaning docs/coverage.html...OK
Cleaning docs/hearthstoneHelper.html...OK
Cleaning docs/index.html...OK
Cleaning docs/restfulServer.html...OK
Cleaning docs/user.html...OK
Cleaning docs/userHandler.html...OK
Cleaning docs/userService.html...OK
Cleaning docs/version.html...OK
Cleaning docs/versionService.html...OK
Running "jshint:all" (jshint) task
>> 26 files lint free.
Running "shell:purge" (shell) task
localhost
Loading fixtures from - mongoose-fixture-config.js
Established Connection MongoD (localhost:27017)
Mongoose-Fixture init schemas/models into conn
/Users/bschmeisser/hear/tim-tang/hearthstone/node_modules/mongoose-fixture/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:286
throw err;
^
MissingSchemaError: Schema hasn't been registered for model "undefined".
Use mongoose.model(name, schema)
at NativeConnection.Connection.model (/Users/bschmeisser/hear/tim-tang/hearthstone/node_modules/mongoose-fixture/node_modules/mongoose/lib/connection.js:625:11)
at /Users/bschmeisser/hear/tim-tang/hearthstone/node_modules/mongoose-fixture/lib/MongooseFixture.js:47:26
at Array.forEach (native)
at /Users/bschmeisser/hear/tim-tang/hearthstone/node_modules/mongoose-fixture/lib/MongooseFixture.js:41:21
at module.exports (/Users/bschmeisser/hear/tim-tang/hearthstone/node_modules/mongoose-fixture/lib/MongooseFixture.js:51:6)
at NativeConnection.<anonymous> (/Users/bschmeisser/hear/tim-tang/hearthstone/node_modules/mongoose-fixture/lib/MongooseFixtureCommand.js:311:31)
at NativeConnection.EventEmitter.emit (events.js:92:17)
at open (/Users/bschmeisser/hear/tim-tang/hearthstone/node_modules/mongoose-fixture/node_modules/mongoose/lib/connection.js:453:10)
at NativeConnection.Connection.onOpen (/Users/bschmeisser/hear/tim-tang/hearthstone/node_modules/mongoose-fixture/node_modules/mongoose/lib/connection.js:461:5)
at /Users/bschmeisser/hear/tim-tang/hearthstone/node_modules/mongoose-fixture/node_modules/mongoose/lib/connection.js:421:10
Warning: Command failed:
/Users/bschmeisser/hear/tim-tang/hearthstone/node_modules/mongoose-fixture/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:286
throw err;
^
MissingSchemaError: Schema hasn't been registered for model "undefined".
Use mongoose.model(name, schema)
at NativeConnection.Connection.model (/Users/bschmeisser/hear/tim-tang/hearthstone/node_modules/mongoose-fixture/node_modules/mongoose/lib/connection.js:625:11)
at /Users/bschmeisser/hear/tim-tang/hearthstone/node_modules/mongoose-fixture/lib/MongooseFixture.js:47:26
at Array.forEach (native)
at /Users/bschmeisser/hear/tim-tang/hearthstone/node_modules/mongoose-fixture/lib/MongooseFixture.js:41:21
at module.exports (/Users/bschmeisser/hear/tim-tang/hearthstone/node_modules/mongoose-fixture/lib/MongooseFixture.js:51:6)
at NativeConnection.<anonymous> (/Users/bschmeisser/hear/tim-tang/hearthstone/node_modules/mongoose-fixture/lib/MongooseFixtureCommand.js:311:31)
at NativeConnection.EventEmitter.emit (events.js:92:17)
at open (/Users/bschmeisser/hear/tim-tang/hearthstone/node_modules/mongoose-fixture/node_modules/mongoose/lib/connection.js:453:10)
at NativeConnection.Connection.onOpen (/Users/bschmeisser/hear/tim-tang/hearthstone/node_modules/mongoose-fixture/node_modules/mongoose/lib/connection.js:461:5)
at /Users/bschmeisser/hear/tim-tang/hearthstone/node_modules/mongoose-fixture/node_modules/mongoose/lib/connection.js:421:10
Use --force to continue.
Aborted due to warnings.
npm ERR! Test failed. See above for more details.
npm ERR! not ok code 0
Success:
{
"success": 1,
"average_star":4.3,
"comments":
[
{
"star":5,
"content":"评论内容1",
"author_id":1,
"author_name":"用户1",
"author_avatar_id":5,
"update_time":"2013-04-26T03:23:32.004385"
},
{
"star":4,
"content":"评论内容2",
"author_id":2,
"author_name":"用户2",
"author_avatar_id":2,
"update_time":"2013-04-27T03:23:32.004385"
},
{
"star":5,
"content":"评论内容3",
"author_id":3,
"author_name":"用户3",
"author_avatar_id":1,
"update_time":"2013-04-28T03:23:32.004385"
},
{
"star":3,
"content":"评论内容4",
"author_id":4,
"author_name":"用户4",
"author_avatar_id":2,
"update_time":"2013-04-29T03:23:32.004385"
},
{
"star":5,
"content":"评论内容5",
"author_id":5,
"author_name":"用户5",
"author_avatar_id":9,
"update_time":"2013-04-30T03:23:32.004385"
}
]
}
Fail:
{
"success": 0,
"message": "卡片id不存在"
}
1.Signup
"email" can be empty.
2.update
"email" & "avatar" can be updated.
3.card model
Add "category" property.
Sample:
{
card_id: 0,
title: "破碎残阳祭司",
category:"仆从",
image_url: "http://img6.cache.netease.com/game/hs/db/cards/20131023_1/zh/EX1_019.png",
content: "战吼:使一个友方随从获得+1/+1。",
abilities: [
{
name: "战吼"
}
],
attack: 3,
health_power: 3,
cost: 3,
rare: "普通",
occupation: "中立",
race: "",
evaluation: "实用的平民玩家强化卡。"
}
4.create comment
request:
{
userId: "528c8fa4460ba8061b000002",
cardId: "528c8fa4460ba8061b000002",
star:5,
content:"This card ..."
}
Requeset:
Content-Type: application/json
{
card_id: 130,
star: 5,
content: "I like this card",
username: "Evan"
}
Success:
{
"success": 1,
"message": "评论成功"
}
Fail:
{
"success": 0,
"message": "卡片id不存在"
}
or
{
"success": 0,
"message": "星级在1-5之间"
}
or
{
"success": 0,
"message": "评论内容在200字以内"
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.