{"id":26562921,"url":"https://github.com/aelfproject/bingo-game-server","last_synced_at":"2026-05-09T13:01:54.094Z","repository":{"id":82312247,"uuid":"200636745","full_name":"AElfProject/bingo-game-server","owner":"AElfProject","description":"a game demo for verifiable random number","archived":false,"fork":false,"pushed_at":"2019-09-09T12:43:15.000Z","size":144,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":7,"default_branch":"master","last_synced_at":"2026-02-24T04:44:51.432Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AElfProject.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-05T10:47:56.000Z","updated_at":"2019-09-09T12:43:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"8f8750b5-b348-415b-bbf4-a697a0803876","html_url":"https://github.com/AElfProject/bingo-game-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AElfProject/bingo-game-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AElfProject%2Fbingo-game-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AElfProject%2Fbingo-game-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AElfProject%2Fbingo-game-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AElfProject%2Fbingo-game-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AElfProject","download_url":"https://codeload.github.com/AElfProject/bingo-game-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AElfProject%2Fbingo-game-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32820171,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-22T15:29:16.473Z","updated_at":"2026-05-09T13:01:54.086Z","avatar_url":"https://github.com/AElfProject.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bingo-game-server\n\n![node](https://img.shields.io/badge/node-\u003e=10.9.0-green.svg)\n\n## Table of Contents\n\n- [Background](#background)\n- [Install](#install)\n- [Develop](#develop)\n- [Production](#production)\n- [API](#api)\n- [Documents](#documents)\n\n## Background\n\nThis is an API service which provides API for [bingo-game-front](https://github.com/AElfProject/bingo-game-front)\n\nWe use [egg](https://github.com/eggjs/egg) to develop API and use [egg-boilerplate-sequelize](https://github.com/eggjs/egg-boilerplate-sequelize) as project template.\n\nYou can take them as references. \n\n## Install\n\n```bash\n# install dependencies\nnpm install\n# or\nyarn\n```\n\n## Develop\n\n### create MySQL database and create tables\n\nInstall MySQL on your own computer and create a database named `aelf_bingo`, which is from the `database/config.json` development field\n\nrun script below to create tables in database `aelf_bingo`.\n```bash\nnpx sequelize db:migrate\n```\n\nWe use `sequelize-cli` as database migrating tool.\n\nHere are some useful scripts\n\n```bash\n# generate migration file\nnpx sequelize migration:generate\n# migrate up\nnpx sequelize db:migrate\n# migrate up for test database\nNODE_ENV=test npx sequelize db:migrate\n# migrate down\nnpx sequelize db:migrate:undo\nnpx sequelize db:migrate:undo:all\n# migrate down for test database\nNODE_ENV=test npx sequelize db:migrate:undo\nNODE_ENV=test npx sequelize db:migrate:undo:all\n```\n\nRun\n```bash\nnpm run dev\n```\nPort `7851` will be opened and check Api routes in `app/router.js`, `Postman` is an useful tool for testing APIs.\n\n \n\n## Production\nAdd MySQL config of your server environment in `database/config.json`,\n```json\n{\n  \"production\": {\n    \"username\": \"root\",\n    \"password\": \"root\",\n    \"database\": \"aelf_bingo\",\n    \"host\": \"127.0.0.1\",\n    \"dialect\": \"mysql\",\n    \"define\": {\n      \"timestamps\": false\n    }\n  }\n}\n```\nAnd create database and tables as above in your server environment\n\n```bash\nnpm start \n```  \nwill open an egg services\n\n## Api\n\n### /bingo/initCsrfToken\n\nIn `production` environment, a security egg plugin need to be enabled to avoid security problem, get `csrfToken` field in cookie and set it as the value of\n`x-csrf-token` in request header if this is request is a `POST` request.\n\n### /bingo/topRecords\n\nGet all records in the order of total `DESC`, and the addresses must have played over 2 times.\n\n* http method：`GET`\n* request params：`none`\n* response params：\n```json\n{\n  \"code\": 0,\n  \"msg\": \"success\",\n  \"data\": {\n    \"total\": 100,\n    \"list\": [{\n      \"address\": \"xxx\",\n      \"total\": 1231,\n      \"times\": 12321\n    }]\n  }\n}\n```\n\n### /bingo/personalRecords\n\nGet personal records\n\n* http method: `GET`\n* request params:\n\n| name | type | required | desc |\n| --- | --- | --- | --- |\n| address | string | yes | user wallet address |\n| pageNum | number | yes | page number start from 1 |\n| pageSize | number | yes | size per page |\n\n* response params:\n```json\n{\n  \"code\": 0,\n  \"msg\": \"success\",\n  \"data\": {\n    \"total\": 100,\n    \"list\": [{\n      \"time\": \"2019-08-19 19:31:26\",\n      \"result\": -100\n    }]\n  }\n}\n```\n\n### /bingo/recordResult\n\nRecord results every time\n\n* http method: `POST`\n* request params:\n\n| name | type | required | desc |\n| --- | --- | --- | --- |\n| address | string | yes | user wallet address |\n| result | number | yes | game result |\n\n* response params:\n```json\n{\n  \"code\": 0,\n  \"msg\": \"success\",\n  \"data\": {}\n}\n```\n\n### /bingo/register\n\nuse registration\n\n* http method: `POST`\n* request params:\n\n| name | type | required | desc |\n| --- | --- | --- | --- |\n| address | string | yes | user wallet address |\n| name | string | yes | user name |\n\n* response params:\n```json\n{\n  \"code\": 0,\n  \"msg\": \"success\",\n  \"data\": {\n    \"count\": 123\n  }\n}\n```\n\n## Documents\n\n[eggjs sequelize document](https://eggjs.org/zh-cn/tutorials/mysql.html)\n\n[egg-sequelize](https://github.com/eggjs/egg-sequelize)\n\n[sequelize](http://docs.sequelizejs.com)\n\n[sequelize-cli and migrations](http://docs.sequelizejs.com/manual/tutorial/migrations.html)\n\n[factory-girl](https://github.com/aexmachina/factory-girl)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faelfproject%2Fbingo-game-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faelfproject%2Fbingo-game-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faelfproject%2Fbingo-game-server/lists"}