- Google Map Boundary File
(boundary.kml)
- Environment Values File
(.env)
- Check Directory Structure
├── Dockerfile
├── package.json
├── README.md
├── data
│ ├── img
│ └── map
│ └── boundary.kml
├── src
│ ├── clue.js
│ ├── config_production.json
│ ├── config_staging.json
│ ├── db.js
│ ├── main.js
│ ├── member.js
│ ├── mission.js
│ ├── pack.js
│ ├── report.js
│ └── tool.js
└── server-log
path_to_project $ npm install
Setup ./src/config_staging.json
path_to_project $ npm test
Setup ./src/config_production.json
git clone https://github.com/ColdeGarage/RunRRR-Backend.git
cd RunRRR
npm install
npm start
docker build -t runrrr-backend .
docker run runrrr-backend
Source code of the project.
main.js
: RESTful API Reqest Handlerobject.js
: Object definition of each object, such as member, mission etc.
Image and other related data used in game.
img/
: Mission Report photo images, Tools images, etc.map/boundary.kml
: Google Map Boundary File
Dumped logs while backend-server is running.
Call the API with URL when you're at EECS822.
URL : OURPATH/api/v1/object/action
The API will return in JSON format.
Every return JSON should include the following 4 entries.
uid
: The unique id of target userobject
: Object type of target object, which is same as api pathaction
: Action to the target object, which is same as api pathbrea
: Status code, 0 is correct.
An alternative payload is sent back if there's some query information.
payload
: The return information of target object
In some read api, if not designate id, it will return a list of items.
There are always 2 entries in payload.
type
: Type of payload, eitherAttribute Name
orObjects
attribute name
: Value of correspondingattribute name
, whereattribute name
can bestatus
,mid
,tid
etc. Only exists whentype
beAttribute Name
.Objects
: Whole objects attributes key/value pair.
Return JSON of /api/v1/member/callhelp
{
"uid": 86,
"object": "member",
"action": "callhelp",
"brea": 0
}
Return JSON of /api/v1/report/create
{
"uid": 34,
"object": "report",
"action": "create",
"brea": 0,
"payload":{
"type": "Attribute Name",
"rid": 16
}
}
Return JSON of /api/v1/mission/read
(requesting mid 12)
{
"uid": 34,
"object": "report",
"action": "create",
"brea": 0,
"payload":{
"type": "Objects",
"objects": [
{
"mid": 12,
"title": "證人救出",
"content": "證人Jacky快要被黑暗組織逮捕啦!! 快去湖心亭將Jacky帶回總部 blah blah blah",
"time_start": "14:03",
"time_end": "14:23",
"price": 1500,
"clue": 8,
"class": "MAIN",
"score": 20,
"location_e": 120.995106,
"location_n": 24.794090
}
]
}
}
Return JSON of /api/v1/mission/read
(No designate mid
{
"uid": 34,
"object": "report",
"action": "create",
"brea": 0,
"payload":{
"type": "Objects",
"objects": [
{
"mid": 12,
"title": "證人救出",
"content": "證人Jacky快要被黑暗組織逮捕啦!! 快去湖心亭將Jacky帶回總部 blah blah blah",
"time_start": "14:03",
"time_end": "14:23",
"price": 1500,
"clue": 8,
"class": "MAIN",
"score": 20,
"location_e": 120.995106,
"location_n": 24.794090
},
{
"mid": 15,
"title": "抓住證人",
"content": "證人Jacky發瘋了! 找到他將他制伏",
"time_start": "14:15",
"time_end": "14:30",
"price": 1100,
"clue": 10,
"class": "SUB",
"score": 10,
"location_e": 0,
"location_n": 0
}
]
}
}