Skip to content

camfairchild/cameraShy-server

Repository files navigation

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"}

About

The server for a mobile game based on facial recognition.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published