0

I have a couple of questions about an app that I am making and publishing on Heroku. I've made a simple HTML/JS game and I want to implement some server side scripts. I have some experience with node and socket.io but I don't know how they work on a Heroku platform. The game is an asynchronous trivia game.

I have the following questions:

1) I want to have many server side functions, how will I call a specific function and pass specific parameters from client side, and vice versa?

Example: Client calls function on server that player 1 finished move (with some answer), I process that info in database and want to then call client side function of player 2 that he is on move.

2) Where should I put server side scripts when I'm deploying?

3) What changes do I need to make in package.json when I want to implement node and what changes should I make for socket.io?

I know that those are some trivial stuff but I never did something like this before and other documentations are unclear, too complicated for stuff like this, etc... I would really appreciate help.

3
  • You can also host your app on xervo.com it provides best hosting for node.js Commented Feb 12, 2017 at 2:09
  • @RohitKumar Thank you on your suggestion but I like Heroku because platform handles all other stuff about publishing app on Facebook. Commented Feb 12, 2017 at 2:49
  • Can anyone help me? Bump Commented Feb 12, 2017 at 20:59

1 Answer 1

1
+50
  1. How will I call a specific function and pass specific parameters from client side, and vice versa?
  • You could develop an API. That way you can make ajax calls from your client-side(front-end) to your API(back-end). It’s very simple with express. Follow this tutorial and you will get there .
  • With an API developed, it’ll be pretty easy for you to handle database queries, scalability and more.
  1. Where should I put server side scripts when I'm deploying?

3) What changes do I need to make in package.json when I want to implement node and what changes do I make for socket.io?

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you my friend! Answer on my first question is BINGO!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.