Registers a new user
[POST] /api/users/register
Limits:
- name: 200 characters
Expected body format:
{
username: 'bob',
password: 'foobar'
}
Expected return format:
{
user_id: 1,
username: 'bob',
password: '2a$08$jG.wIGR2S4hxuyWNcBf9MuoC4y0dNy7qC/LbmtuFBSdIhWks2LhpG'
}
Login an existing user, returns with a login token
[POST] /api/users/login
Expected body format:
{
username: 'bob',
password: 'foobar'
}
Expected return format:
{
message: 'welcome, bob',
token: 'eyJhbGciOiJIUzI ... ETC ... vUPjZYDSa46Nwz8'
}
Get potlucks in an array or by id
[GET] /api/potluck
Expected return format:
[
{
pid: 1,
name: 'bobs potluck',
date: 'feb 2',
time: '2pm',
location: '2nd cherry st'
user_id: 1
},
{
...
},
...
]
[GET] /api/potluck/:id
Expected return format:
{
pid: 1,
name: 'bobs potluck',
date: 'feb 2',
time: '2pm',
location: '2nd cherry st'
user_id: 1
}
Create a new potluck
Limits:
- name: 128 characters
- date: 15 characters
- time: 15 characters
- date: 15 characters
- location: 128 characters
[POST] /api/potluck
Expected body format:
{
name: 'bobs potluck',
date: 'feb 2',
time: '2pm',
location: '2nd cherry st',
user_id: 1
}
Expected return format:
{
pid: 1,
name: 'bobs potluck',
date: 'feb 2',
time: '2pm',
location: '2nd cherry st',
user_id: 1
}
Modify an existing potluck
[PUT] /api/potluck/:id
Expected body format:
{
name: 'bob's birthday'
}
Expected return format:
{
pid: 1,
name: 'bobs birthday',
date: 'feb 2',
time: '2pm',
location: '2nd cherry st',
user_id: 1
}
Delete an existing potluck
[DELETE] /api/potluck/:id
Expected return format:
{
pid: 1,
name: 'bobs birthday',
date: 'feb 2',
time: '2pm',
location: '2nd cherry st',
user_id: 1
}
Get users attending a potluck by id
[GET] /api/potluck/:id/attend
Expected return format:
[
{
user_id: 1,
username: 'bob'
},
{
...
},
...
]
Add a user to a potluck
[POST] /api/potluck/:id/attend
Expected body format:
{
user_id: 1,
username: 'bob'
}
Expected return format:
[
{
user_id: 1,
username: 'bob'
},
{
...
},
...
]
Remove a user from a potluck
[DELETE] /api/potluck/:id/attend/:user_id
Expected return format:
{
user_id: 1,
username: 'bob'
}
Get items for a potluck id
[GET] /api/potluck/:id/items
Expected return format:
[
{
item_id: 1,
name: 'chips',
responsible: null
},
{
...
},
...
]
Create an item for a potluck id
Limits:
- name: 128 characters
[POST] /api/potluck/:id/items
Expected body format:
{
name: 'chips'
}
Expected return format:
{
item_id: 1,
name: 'chips'
}
Update an item for a potluck id and item id
[PUT] /api/potluck/:id/items/:item_id
Expected body format:
{
name: 'foobar',
responsible: 1
}
Expected return format:
{
item_id: 1,
name: 'foobar',
responsible: 1
}
Delete an item for a potluck id and item id
/api/potluck/:id/items/:item_id
Expected return format:
{
item_id: 1,
name: 'chips',
responsible: null
}