Jump to content

How to run Phaser and MongoDB


ketys
 Share

Recommended Posts

Hello, I am trying (unsuccessfully) to connect Phaser with MongoDB, so I have installed Node.js, MongoDB, download Phaser and via npm install grunt and mongoose. What should I do next? How can I read/write some data from/to my database? Thank you very much!

Link to comment
Share on other sites

Phaser is not going to connect to Mongo directly. You're going to need to write a server that runs in Node (using mongoose) that connects to the DB and, probably, serves your game as static content.

 

If you need data out of Mongo you can use an XMLHttpResponse object on the client side to send a request to your server which will then query the DB and send the response back to the client.

 

I think more recent versions of Mongo let you run a query directly from the browser but I'd hesitate to set something like that up on the open Internet for security reasons.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...