Clone down this repo
Run npm i
to install all the dependencies
Run npm start
to get the server going on your machine
All endpoints should be prepended with: http://color-picker-backend.herokuapp.com/
GET /api/v1/projects
Status | Response |
---|---|
200 (success) | an array of all projects |
500 (internal error) | error message |
A successful response will return an array of project
objects. Each project
is comprised of:
Name | Data Type |
---|---|
id | number |
name | string |
Example Response:
[
{
"id": 1,
"name": "Master Bedroom"
},
{
"id": 2,
"name": "Kitchen"
}
]
GET /api/v1/palettes
Status | Response |
---|---|
200 (success) | an array of all palettes |
500 (internal error) | error message |
A successful response will return an array of palette
objects. Each palette
is comprised of:
Name | Data Type |
---|---|
id | number |
project_id | number |
palette_name | string |
color_1 | string |
color_2 | string |
color_3 | string |
color_4 | string |
color_5 | string |
Example Response:
[
{
"id": 1,
"project_id": 1,
"palette_name": "accent wall",
"color_1": "#58e714",
"color_2": "#528a1a",
"color_3": "#071723",
"color_4": "#8400f1",
"color_5": "#4d07e6"
},
{
"id": 2,
"project_id": 1,
"palette_name": "remaining walls",
"color_1": "#9bdb2e",
"color_2": "#a1b307",
"color_3": "#492c29",
"color_4": "#18aa5a",
"color_5": "#ee051c"
},
{
"id": 3,
"project_id": 2,
"palette_name": "kitchen colors",
"color_1": "#58e714",
"color_2": "#a1b307",
"color_3": "#8400f1",
"color_4": "#4d07e6",
"color_5": "#ee051c"
},
]
GET /api/v1/projects/:id
Status | Response |
---|---|
200 (success) | the associated project object |
404 (error) | a message that there is no matching project with that name |
Example response:
{
"id": 1,
"name": "Master Bedroom"
}
GET /api/v1/palette/:id
Status | Response |
---|---|
200 (success) | the associated palette object |
404 (error) | A message indicating there is not a palette with a corresponding name |
Example response:
{
"id": 3,
"project_id": 2,
"palette_name": "kitchen colors",
"color_1": "#58e714",
"color_2": "#a1b307",
"color_3": "#8400f1",
"color_4": "#4d07e6",
"color_5": "#ee051c"
}
POST /api/v1/projects
Name | Data Type |
---|---|
name | string |
Status | Response |
---|---|
201 (success) | the ID of the newly added project |
422 (unprocessable) | 'Expected format { name: }, missing name!' |
Example response:
{
"id": 4
}
POST /api/v1/palettes
Name | Data Type |
---|---|
name | string |
color_1 | string |
color_2 | string |
color_3 | string |
color_4 | string |
color_5 | string |
Status | Response |
---|---|
201 (success) | the ID of the newly added palette |
422 (unprocessable) | A message indicating which required parameter is missing from the request |
DELETE /api/v1/projects/:id
Status | Response |
---|---|
201 (success) | 'Successfully deleted' |
DELETE /api/v1/palettes/:id
Status | Response |
---|---|
201 (success) | 'Successfully deleted' |
PATCH /api/v1/projects/:id
Name | Data Type |
---|---|
name | string |
Status | Response |
---|---|
202 (success) | 'Project name successfully updated' |
404(error) | message indicating that matching project could not be found to update |
PATCH /api/v1/projects/:id
1 of the following:
Name | Data Type |
---|---|
palette_name | string |
color_1 | string |
color_2 | string |
color_3 | string |
color_4 | string |
color_5 | string |
Status | Response |
---|---|
202 (success) | 'Palette successfully updated' |
404(error) | message indicating that matching palette could not be found to update |