Giter VIP home page Giter VIP logo

diplicity's Introduction

diplicity

A dippy API service based on App Engine and godip.

Forum

Discussions about this project happen at https://groups.google.com/forum/#!forum/diplicity-dev.

Public host

A regularly updated service running this code is available at https://diplicity-engine.appspot.com/.

Play the game

To play, either be brave and use the auto generated HTML UI at https://diplicity-engine.appspot.com/, or use one of the client projects:

Architecture

The API uses a slightly tweaked HATEOAS style, but is basically JSON/REST.

Auto generated HTML UI

To enable exploration of the API for debugging, research by UI engineers or even playing (not for the faint of heart) the API delivers a primitive HTML UI when queried with Accept: text/html.

Forcing JSON output

To enable debugging the JSON output in a browser, adding the query parameter accept=application/json will make the server output JSON even to a browser that claims to prefer text/html.

Running locally

To run it locally

  1. Clone this repo.
  2. Install the App Engine SDK for Go.
  3. Make sure your $GOPATH is set to something reasonable, like $HOME/go.
  4. Run go get -v ./... in the root directory.
  5. Run dev_appserver.py . in the app directory.
  6. Run curl -XPOST http://localhost:8080/_configure -d '{"FCMConf": {"ServerKey": SERVER_KEY_FROM_FCM}, "OAuth": {"ClientID": CLIENT_ID_FROM_GOOGLE_CLOUD_PROJECT, "Secret": SECRET_FROM_GOOGLE_CLOUD_PROJECT}, "SendGrid": {"APIKey": SEND_GRID_API_KEY}}'.
    • This isn't necessary to run the server per se, but FCMConf is necessary for FCM message sending, OAuth is necessary for non fake-id login, and SendGrid is necessary for email sending.

Faking user ID

When running the server locally, you can use the query parameter fake-id to set a fake user ID for your requests. This makes it possible and easy to test interaction between users without creating multiple Google accounts or even running multiple browsers.

Faking user email

When running the server locally, you can also use the query parameter fake-email to set the fake email of the fake user ID. This makes it possible and easy to test the email notification system.

Running the tests

To run the tests

  1. Start the local server with a --clear_datastore to avoid pre-test clutter, --datastore_path=autotest to avoid clobbering your manual test database, and --datastore_consistency_policy=consistent to avoid eventual consistency. Since the tests don't wait around for consistency to be achieved, this simplifies writing the tests. Also, use --require_indexes so that you verify all the necessary indices are present in app/index.yaml. If you find indices for Game missing, update and run go run tools/genindex.go, for other entity types remove app/index.yaml, run go run tools/genindex.go and then run the tests without --require_indexes to let dev_appserver.py add missing indices as it comes across them. The reason Game indices are special is that they are built using composite indexes according to https://cloud.google.com/appengine/articles/indexselection.

dev_appserver.py --require_indexes --skip_sdk_update_check=true --datastore_path=autotest --clear_datastore=true --datastore_consistency_policy=consistent .

  1. Run go test -v in the diptest directory.

diplicity's People

Contributors

slt avatar tttppp avatar zond avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.