Skip to content

SamuelColeman/color_picker_be

Repository files navigation

Color Picker

by: Michael Schneider and Samuel Coleman

Michael Schneider
Samuel Coleman

Summary:

live site Custom built back-end that builds two tables: Projects and Palettes. Palettes are connected to Projects with a foreign key. 10 endpoints allow the user to access and manipulate the database as necessary.

Installation:

  • First fork this repo and clone down your own copy.
  • Once cloned, run npm install and npm start in your terminal. In your browser visit localhost: 3001.
  • Try out the endpoints using a program like Postman

Tech Stack:

This application utilizes: knex, express, ES6, node.js, cors and TravisCI. Deployed with Heroku.

Story Board:

Project

API Endpoints

GET all projects example request : `GET` `/api/v1/projects`
example response:
[
  {
      "id": 14,
      "projectId": 1,
      "name": "BYOB",
      "created_at": "2019-12-05T20:00:47.912Z",
      "updated_at": "2019-12-05T20:00:47.912Z"
  }
]

GET all palettes example request : `GET` `/api/v1/palettes`\
example response:
[
  {
      "id": 22,
      "projectId": 1,
      "name": "cooler colors",
      "color1": "#668B7B",
      "color2": "#B8CDCD",
      "color3": "#4F4F4F",
      "color4": "#7A9B8B",
      "color5": "#938B9B",
      "created_at": "2019-12-05T20:00:47.915Z",
      "updated_at": "2019-12-05T20:00:47.915Z"
  }
]

GET a specific project by appending the project id example request : `GET` `/api/v1/projects/14`
example response:
[
  {
      "id": 14,
      "projectId": 1,
      "name": "BYOB",
      "created_at": "2019-12-05T20:00:47.912Z",
      "updated_at": "2019-12-05T20:00:47.912Z"
  }
]

GET a specific palette by appending the palette id example request : `GET` `/api/v1/palettes/22`
example response:
[
  {
      "id": 22,
      "projectId": 1,
      "name": "cooler colors",
      "color1": "#668B7B",
      "color2": "#B8CDCD",
      "color3": "#4F4F4F",
      "color4": "#7A9B8B",
      "color5": "#938B9B",
      "created_at": "2019-12-05T20:00:47.915Z",
      "updated_at": "2019-12-05T20:00:47.915Z"
  }
]

POST a new project to the database example request : `POST` `/api/v1/projects`
body.json()
{
  "projectId": 10,
  "name": "Example Project"
}

example response:

{
  "id": 16
}

POST a new palette to the database example request : `POST` `/api/v1/palettes`
body.json()
{
  "projectId": 10,
  "name": "Example Project",
  "color1": "#668B7B",
  "color2": "#B8CDCD",
  "color3": "#4F4F4F",
  "color4": "#7A9B8B",
  "color5": "#938B9B"
}

example response:

{
  "id": 25
}

PATCH a project name by selecting the id

example request : PATCH /api/v1/projects/1 body.json()

{
  "name": "Example Project"
}

example response:
{
  "message": "Project renamed!"
}

PATCH a palettes colors by selecting the id

example request : PATCH /api/v1/palettes/22 body.json()

{
  "color1": "#FFFFFF"
}

example response:
{
  "message": "Palette color reassigned!"
}

DELETE a project by appending its id

example request : DELETE /api/v1/projects/10
example response:

"Project 10 deleted"

DELETE a palette by appending its id

example request : DELETE /api/v1/palettes/25
example response:

"Palette 25 deleted"

About

Mod 4 pair project, back end

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published