Skip to content

deadlyfingers/ARStudioAzureFunctions

Repository files navigation

AR Studio game backend with Azure Functions Build Status

Note: AR Studio requires a Mac so we everything here is written for Mac user, but everything should run ok on Windows once available.

Prerequistes for testing and running localhost on Mac

Test on device using localhost

  1. Start mongodb
    mongod
  2. Start Azure Functions locally
    func host start --debug VSCode
  3. Start ngrok https server
    ngrok http 7071
  4. Clone the AR Studio game project and add your ngrok domain to whitelisted domains. (Refer to the readme for config instuctions.)

API

The API is available as Postman collection which can be imported into Postman app.

  • LobbyCreate
  • LobbyJoin
  • LobbyDelete
  • MatchReady
  • MatchStatus
  • MatchTurn
  • MatchDelete

Testing

npm test

Deployment

  1. Fork this repo
  2. Sign in to Azure portal
  3. Create new Azure Function
  4. Once your Azure Function is provisioned then update your Function app settings to use version 2 (beta) azurefunctions-v2-beta
  5. Create new Azure Cosmos DB and select MongoDB from the API options. Once it's provisioned then select 'Connection String' under Settings and copy your connection details including HOST, PORT, USERNAME, PRIMARY PASSWORD
  6. Back in your Azure Function add the following environment variables using your connection details:
    • MongoDBHost
    • MongoDBPort
    • MongoDBUser
    • MongoDBPass
  7. To deploy your Function app select
    Platform Features > Deployment Options > Setup > GitHub
    and choose your forked repo.