Cameron MacRae
Heather Faerber
This back end application provides a RESTful API server with endpoints to allow data retrieval, removal, and manipulation.
This server is used in our front end application Palette Picker. Here, users can create projects and color palettes that can be added, removed and updated using this back end server.
- Clone this repo and run npm install
- Run the server by using npm start
The server will run on http://localhost:3000
.
Heroku Deployment: https://palette-picks.herokuapp.com/api/v1/projects
Purpose | URL | Verb | Request Body | Sample Success Response |
---|---|---|---|---|
Get all projects | /api/v1/projects |
GET | N/A | {projects: [{}, {}, ...]} See example |
Get all palettes for a given project | /api/v1/projects/:id/palettes |
GET | N/A | {palettes: [{}, {}, ...]} See example |
Get all palettes (any project) | /api/v1/palettes |
GET | N/A | {palettes: [{}, {}, ...]} See example |
Get all palettes with queried color | /api/v1/projects/:id/palettes?color=:hexcharacters |
GET | N/A | {palettes: [{}, {}, ...]} See example |
Get specific project | /api/v1/projects/:id |
GET | N/A | {} See example |
Get specific palette | /api/v1/palettes/:id |
GET | N/A | {} See example |
Post a project | /api/v1/projects |
POST | { name: <String> } |
{ id: <Number> } See example |
Post a palette | /projects/:id/palettes |
POST | { name: <String>, color_one: <String>, color_two: <String>, color_three: <String>, color_four: <String>, color_five: <String> } |
{ id: <Number> } See example |
Delete a project | /api/v1/projects/:id |
DELETE | N/A | Project with id 3595 has been removed successfully See example |
Delete a palette | `/palettes/:id' | DELETE | N/A | Palette with id 7283 has been removed successfully See example |
Update a project name | /api/v1/projects/:id |
PATCH | { name: <String> } |
{ id: <Number> } See example |
Update a palette name | /api/v1/palettes/:id |
PATCH | { name: <String> } |
{ id: <Number> } See example |
Path: /api/v1/projects
Sample Response:
{ projects: [ { id: 35, name: 'Sample Project One', created_at: '2020-02-05T00:52:52.258Z', updated_at: '2020-02-05T00:52:52.258Z' }, { id: 36, name: 'Sample Project Two', created_at: '2020-02-05T00:52:52.261Z', updated_at: '2020-02-05T00:52:52.261Z' } ] }
Path: /api/v1/projects/:id/palettes
Sample Response:
{ palettes: [ { id: 6384, name: 'Sample Palette one', color_one: '#F7D951', color_two: '#75B1FF', color_three: '#985EEE', color_four: '#5ED49B', color_five: '#44638F', projects_id: 3230, created_at: 2020-02-08T00:59:46.352Z, updated_at: 2020-02-08T00:59:46.352Z }, { id: 6385, name: 'Sample Palette two', color_one: '#DC5551', color_two: '#F2AD00', color_three: '#6CA131', color_four: '#4B5DC6', color_five: '#1F0E95', projects_id: 3230, created_at: 2020-02-08T00:59:46.352Z, updated_at: 2020-02-08T00:59:46.352Z } ] }
Path: /api/v1/projects/:id
Sample Response:
{ id: 3320, name: 'Sample Project One', created_at: 2020-02-08T01:01:18.691Z, updated_at: 2020-02-08T01:01:18.691Z }
Path: /api/v1/palettes/:id
Sample Response:
{ id: 181, name: 'Sample Palette one', color_one: '#F7D951', color_two: '#75B1FF', color_three: '#985EEE', color_four: '#5ED49B', color_five: '#44638F', projects_id: 91, created_at: '2020-02-05T01:49:59.421Z', updated_at: '2020-02-05T01:49:59.421Z' }
Path: /api/v1/palettes
Sample Response:
{ palettes: [ { id: 6384, name: 'Sample Palette one', color_one: '#F7D951', color_two: '#75B1FF', color_three: '#985EEE', color_four: '#5ED49B', color_five: '#44638F', projects_id: 3230, created_at: 2020-02-08T00:59:46.352Z, updated_at: 2020-02-08T00:59:46.352Z }, { id: 6385, name: 'Sample Palette', color_one: '#DC5551', color_two: '#F2AD00', color_three: '#6CA131', color_four: '#4B5DC6', color_five: '#1F0E95', projects_id: 3231, created_at: 2020-02-08T00:59:46.352Z, updated_at: 2020-02-08T00:59:46.352Z } ] }
Path: /api/v1/palettes?color=:hexcharacters
Sample Query Format:
Hex characters must be 6 digits. Digits/letters only - do not include "#".
/api/v1/palettes?color=FFFFFF
Sample Response:
{ palettes: [ { id: 6384, name: 'new palette one', color_one: '#F7D951', color_two: '#FFFFFF', color_three: '#985EEE', color_four: '#5ED49B', color_five: '#44638F', projects_id: 3230, created_at: 2020-02-08T00:59:46.352Z, updated_at: 2020-02-08T00:59:46.352Z }; { id: 6385, name: 'new palette two', color_one: '#DC5551', color_two: '#F2AD00', color_three: '#6CA131', color_four: '#4B5DC6', color_five: '#FFFFFF', projects_id: 3231, created_at: 2020-02-08T00:59:46.352Z, updated_at: 2020-02-08T00:59:46.352Z } ] }
Path: /api/v1/projects
Sample Request Body:
{ name: 'Test Project' }
Sample Response:
{ id: 3416 }
Path: /api/v1/projects/:id/palettes
Sample Request Body:
{ name: 'new palette', color_one: '#111111', color_two: '#222222', color_three: '#333333', color_four: '#444444', color_five: '#555555' }
Sample Response:
{ id: 6845 }
Path: /api/v1/projects/:id
Sample Response:
Project with id 3595 has been removed successfully
Path: /api/v1/palettes/:id
Sample Response:
Palette with id 7283 has been removed successfully
Path: /api/v1/projects/:id
Sample Request Body:
{ name: 'Updated Project Name' }
Sample Response:
{ id: 3701 }
Path: /api/v1/palettes/:id
Sample Request Body:
{ name: 'New and improved palette name' }
Sample Response:
{ id: 7319 }