thatrussguy / mission-labs-tech-test

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mission-labs-tech-test

Project on Heroku

Node-based REST API that has CRUD methods to create, read, update and delete a set of products.

Uses a SQLite database for development/testing, and PostgreSQL for production.

Getting Started

Set up a local copy to try out the API

Clone the project

git clone https://github.com/thatrussguy/mission-labs-tech-test.git

Install dependencies

npm install

Run tests

npm test

Set up database

npm run migrate-latest

Seed database

npm run seed

Start the app locally

npm run start

The app should now running on http://localhost:9090

Using the API

The following endpoints are available

GET /products

Responds with

  • an array of product objects, each of which has the following properties:
    • category
    • name
    • price
    • product_id
    • sizes

Accepts queries

  • priceFrom, which filters the products by minimum price
  • priceTo, which filters the products by maximum price

POST /products

Request body accepts

  • an object with the following properties:
    • category
    • name
    • price
    • sizes

Responds with

  • the posted product

GET /products/:product_id

Responds with

  • a product object, which has the following properties:
    • category
    • name
    • price
    • product_id
    • sizes

PATCH /products/:product_id

Request body accepts

  • an object with any of the following properties:

    • category
    • name
    • price
    • sizes

Responds with

  • the updated product

DELETE /products/:product_id

Result

  • delete product product_id

Responds with

  • status 204 and no content

Prerequisites

Built With

About


Languages

Language:TypeScript 97.4%Language:JavaScript 2.6%