Skip to content

Latest commit

 

History

History
74 lines (55 loc) · 3.11 KB

README.md

File metadata and controls

74 lines (55 loc) · 3.11 KB

squad-techstore-service

REST API service connecting to PostgreSQL for relational data storage and CRUD Operations

Technology

squad-techstore-service uses a number of open source projects to work properly:

Local Setup (Quick start)

Squad-techstore-service requires Docker v20+ to run. All application dependencies will be packaged within the docker containers.

cd squad-techstore-service
cp .env.example .env
docker compose up --build

After copying the .env file you may configure it to set your preferred ports and PostgreSQL authentication configurations.

Using any http client of your choice (Postman, cURL etc) you can begin querying against the API service in the following ways

Running the unit tests

Once the App is started, either in the docker container or otherwise, you may run the unit tests using Jest + Supertest

npm test

Database Structure

If you're running it locally using docker, you don't need to worry about the DB structure. It is defined in the ./db/seed/init.sql file. Here's the structure:

  • A single DB schema with the name you set for APP_DB_POSTGRES_DB in the .env file
  • A single DB table named item in that schema
  • The definition of the item table to match the specification provided
    • An extra field included just based on my preference
CREATE TABLE IF NOT EXISTS items (
  id serial PRIMARY KEY,
  name VARCHAR (50) NOT NULL,
  description VARCHAR (150) NOT NULL,
  price DECIMAL(18, 2) NOT NULL,
  img_url VARCHAR(150)
);

License

MIT