Skip to content

JohnMalmsteen/mobile-apps-server-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

mobile-apps-server-code

Node.js code for server side stuff, user management and save game info

Nebin

Contents:

  1. About
  2. How to Query the API
  3. Tools & Environment used
  4. Team

1 - About

This is the node.js server side code for ou mobile apps game project which we also intend to submit to the games fleadh in March 2016.

The aim of this code is to provide user management, session management and cloud save/load capabilities for our Unity game, the repositroy for which can be found here. The user should be able to create an account, login and save/load their characters from the game.

The API is designed be REST compliant but only serves and receives JSON, not XML.

2 - How to Query the API

The endpoints here are fairly self documenting as per the REST standard requirements, and only the GET and POST HTTP request verbs are used (lo-REST) to make it maximally compliant with the various XHTTP request implementations. However it should be noted that loading characters is done with a post so that the token you send over remains encrpyted with SSL.

Routes

Route HTTP Method Description Body Return
/ GET Basic API route (no functionality) {message: 'This is the Nebins Tower API'}
/register/ POST Route that allows for new user registration {username: [username], password: [password]} {token: token}
/user/:username GET Route that checks if a certain [:username] exists, used for the registration form {exists: boolean})
/login/ POST Route that logs the user in {username: [username], password: password} {token: token}
/saveCharacters/ POST Route for saving data to the database {username: [username], token: [token], savedata: [savedata in json]} {message: 'Save Successful'}
/loadCharacters/ POST Route for loading data from the database {username: [username], token: [token]} {savedataJSON}

3 - Tools and Environments used

As previously mentioned, this is a node.js server (the code for which is here running on an Ubuntu Server 14.04 LTS on Azure, its address is https://nebinstower.cloudapp.net:5000/ for SSL traffic and http://nebinstower.cloudapp.net:5001/ for standard unencrypted HTTP traffic.

The npm dependencies can be seen in the package.json file.

We used MongoDB as our database and it runs on the same host and can't be accessed except through the node.js middleware or via ssh to the server. We selected MongoDB to allow flexibility of save data as we will likely massively change the datastructures used so a schemaless system was required.

Should you wish to run this code elsewhere you will need npm, nodejs and mongodb installed, you will also need an ssl certificate and key which can be placed in a "sslcert/" directory beside the userManagement.js file.

4 - Team

This project was created by Andrew Sweenet & John Frizzell,
Software Development students in fourth year, term 1, GMIT
for the Mobile Applications Development Module.

Andy Image John Image

About

Node.js code for server side stuff, user management and save game info

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published