Code Monkey home page Code Monkey logo

camerashy-server's Introduction

cameraShy-server

Acts as the server for the Camera-Shy game

Project Updates

The server currently uses a REST API implemented in ExpressJS and NodeJS. This makes client updates not very efficient. We plan to continue work on the game, transitioning it to websockets, for real-time client-server updates. Development is happening when I have free-time to invest in the project.

Installation

Can be installed by running

npm install

Server API Reference

RESTful API /api

/api/createGame POST

Used to create a Game

request body:

{
    appleId: string,
    numPlayers: number,
    time: number,
    lat: number,
    long: number,
    bound: [number],
    rad: number
}

response:

Status Code 200

Success, the Game was created. gameId is used to join

{ gameId: gameId }

Also sends OneSig Notif to Host:

Title: "Game Created!"
Text: "Join code: " + gameId,

Status Code 404

Host's appleId doesn't exist

{error: "Host doesn't exist!"}

Status Code 500

Some other error

{error: "error text"}

/api/createUser POST

Used to create a User

request body:

{
    name: string,
    id: number, // Apple Login ID
    osId: number // One Signal ID
}
extra:

Image of face. Field Name: img

response:

Status Code 200

Success, the User was created. appleId is used to reference User

Status Code 500

Some other error

{error: "error text"}

/api/gallery GET

Used to get the URL of all files in the Gallery

request params:

None

response:

Status Code 200

Success.

{ fnames: [
    // Relative file URLs
    "/uploads/file.jpg",
    "/uploads/file.png"
]
}
extra:

Will return empty array if there are no images in Gallery.

Status Code 500

Some other error

{error: "error text"}

/api/avatar GET

Used to get the URL of the avatar for the User with appleId

request params:

{ appleId: string }

response:

Status Code 200

Success.

{ avatarUrl: string }

Status Code 404

Error: User with appleId does not exist

{ error: `User with appleId ${appleId} does not exist` }

Status Code 500

Some other error

{error: "error text"}

/api/numPlayers GET

Used to get the number of Users in the Game with gameId

request params:

{ gameId: string }

response:

Status Code 200

Success.

{ numPlayers: number }

Status Code 404

Error: Game with gameId does not exist.

{ error: `Game with gameId ${gameId} does not exist` }

Status Code 500

Some other error

{error: "error text"}

camerashy-server's People

Contributors

camfairchild avatar

Watchers

 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.