The back end of Rank Tank
> npm install
> node app
Hit the url http://localhost:3000/index.html
for a shiny landing page.
tank: {
title: "Tank",
description: "This is a tank",
items: [{
// arbitrary props
}, {
...
}],
// user info related to this tank
users: [{
user: _userId,
// history of user in this tank
actions: [{
action: 'joined',
date: new Date()
}],
// keeps track of item order per user
items: [{
item: _itemId,
list: 'bank',
relativePosition: 1000
}, {
item: _itemId,
list: 'rank',
relativePosition: 2000
}, {
...
}]
}, {
// more users
...
}]
}
user: {
firstName: 'Optimus',
lastName: 'Prime',
username: 'tanker1',
email: '[email protected]',
photo: 'url://prime.png',
...
}
Response:
[{tank}, {tank}, ...]
Request:
{
title: 'Rank',
description: 'Tank'
}
Response:
{tank}
Response:
{tank}
Request:
{
title: 'New title',
description: 'New description'
}
Response:
{tank}
Yanks a tank of ranks from your bank.
Response:
[{tank.user}, {tank.user}, ...]
Join a tank.
Request:
Nada
Response:
{tank.user}
Leave a tank
Response:
{tank.user}
Response:
[{tank.user.item}, {tank.user.item}, ...]
Move items between lists or reorder items within a list.
Request:
{
list: 'rank',
relativePosition: 1001
}
Response:
{tank.user.item}
[ranked]
Also adds item to each user's item list.
Request:
{
// anything
}
Response:
{item}
[{item}, {item}, ...]
{item}
Request:
{
// anything
}
Response:
{item}
Also remove item from everyone's userTank
Request:
{user}
Response:
{user}
CRUD on users.