Skip to content

aautem/cointrail-api

Repository files navigation

Cointrail

An online Connect 4/Tic-Tac-Toe hybrid with no tie games. The API repo contains the web socket server and RESTful API while the client repo contains the Android/iOS codebase built with React Native.

Table of Contents

Google Play

The alpha version of Cointrail is currently available in the Google Play Store for testing and feedback. Thank you in advance to anyone taking the time to download and play the game.

Development

For best results, work off of the develop branch in the API and client repositories.

Cointrail API

First, run npm install from the root directory to download the dependencies.

MongoDB

On line 2 of ./database/db.js you will need to plug in your own local MongoDB URI.

Auth0

You will also need to create an Auth0 client for authentication with Google and Facebook connections. Auth0 already provides dev keys for these two platforms so you'll just have to enable them. Add the following to your client's "Allowed Callback URLs":

http://localhost:3000/callback,
com.cointrail://${YOUR_AUTH0_DOMAIN}/android/com.cointrail/callback,
org.reactjs.native.example.cointrail://${YOUR_AUTH0_DOMAIN}/ios/org.reactjs.native.example.Cointrail/callback

Plug your Auth0 client credentials into the ./config.js file.

Starting the Server

Run npm start from the root directory and navigate to localhost:3000 in your browser where you'll see the text .~:: C O I N T R A I L ::~. if your server is running correctly.

Cointrail Client

Running this application locally requires a separate client repository for the React Native codebase and will need some custom configuration.

  • Run npm install from the root directory to download the dependencies.
  • Update the API_URL constant on line 2 of ./src/utilities/const.js to use your locally running server at localhost:3000 from above.
  • Update ./android/local.properties to point to the location of your Android SDK.
  • Add this to your ./android/settings.gradle file to correctly configure Auth0:
rootProject.name = 'Cointrail'
include ':react-native-auth0'
project(':react-native-auth0').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-auth0/android')

include ':app'
  • Format the .MainActivity portion of your AndroidManifest.xml file to look like so, plugging your Auth0 domain into the android:host property:
<activity
  android:name=".MainActivity"
  android:label="@string/app_name"
  android:launchMode="singleTask"
  android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
  android:screenOrientation="portrait"
  android:windowSoftInputMode="adjustResize">
  <intent-filter>
      <action android:name="android.intent.action.MAIN" />
      <category android:name="android.intent.category.LAUNCHER" />
  </intent-filter>
  <intent-filter>
      <action android:name="android.intent.action.VIEW" />
      <category android:name="android.intent.category.DEFAULT" />
      <category android:name="android.intent.category.BROWSABLE" />
      <data
          android:host="${YOUR_AUTH0_DOMAIN}"
          android:pathPrefix="/android/${applicationId}/callback"
          android:scheme="${applicationId}" />
  </intent-filter>
</activity>
  • Add this to your ./android/app/build.gradle file to manually link vector icons:
// React Native vector icons
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
  • Run react-native link from the root directory to link any other unlinked dependencies.

Available Scripts

npm run android

Runs your app in development mode and attempts to open your app on a connected Android device or emulator. Requires an installation of Android build tools (see React Native docs for detailed setup).

npm run ios

Runs your app in development mode and attempts to open your app in the iOS Simulator if you're on a Mac and have it installed.

If this command fails, manually launch the Xcode project file in ./ios then "Clean," "Build" and "Run."

Roadmap

Please find the Cointrail roadmap and open issues here.

Contributing

Please see ./.eslintrc.json in the client repo for style guidelines and thank you in advance for any PRs. I appreciate the help!

Resources

This project was bootstrapped with Create React Native App and has since been ejected.

About

Socket server and RESTful API for the Cointrail mobile app.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published