GithubHelp home page GithubHelp logo

vsadeghizade / hq_game Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 19 KB

HQ is the wildly popular live game show app where you can win real cash prizes for free. It's a sample of how to implement an HQ game with Node.JS, Socket.io, Redis and MySql

License: MIT License

JavaScript 100.00%
event-emitter expressjs hq hq-trivia javascript mysql nodejs promise question-answering questions-and-answers

hq_game's Introduction

HQ_Game

License: MIT

This code has been used in part of my project manamo.app which provides an online HQ game for many of the users who learn English from Manamo consistently, this part of the Manamo had lots of challenges for me therefore I decided to share that with you and I'm hopeful that would be useful.

So here I will share my experience along with a sample code that will demonstrate how to create an HQ online game with Node.js along with MySql and Redis. and also I provided a "manage" route with REST API methods to manage the game through API Requests.

I consider this code is a sample and you should implement users authentication and users table by yourself base on JWT or Oauth2. Please notice that I used PM2 to run Node.js on CentOS server but you can use alternative options.

Built With

  • Node.js
  • Express.js
  • Socket.io
  • MySql
  • Redis

Packages Used

  • Promise - Handle the result of an asynchronous task
  • Sequelize - Object Relational Mapper
  • Sequelize-redis-cache - Cache MySql tables in Redis
  • EventEmitter - Handle custom events module
  • Express-validator - Validator and sanitizer functions
  • Socket.io-redis - Adapter to enable broadcasting events
  • Apidoc - API documantation

Prerequisite

  • node & npm
  • MySql
  • Redis
  • pm2

Installation

npm install

Install pm2 globally

npm install pm2 -g

Setup MySql and Redis

You should create MySql tables base on (/models/files) then set your MySql and Redis configration in (/config/config.json)

Start application

NODE_ENV=production PORT=[your preference port] pm2 start /bin/www --name "HQ_Game" --max-memory-restart [your preference memory]

Contributing

All contributions welcome.

Credits

License

The MIT License (MIT)

hq_game's People

Contributors

vsadeghizade avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.