@ -2,16 +2,38 @@
An online storefront to showcase products. Users is able to browse an index of all products, see the specifics of a single product, and add products to an order that they can view in a cart page.
# Pre-requisite
- Add a `.env` file in /Shelf folder with the following :
```
POSTGRES_HOST=127.0.0.1
POSTGRES_DB=shelf
POSTGRES_TEST_DB="shelf_test"
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
ENV=dev
BCRYPT_PASSWORD=speak-friend-and-enter
SALT_ROUNDS=10
TOKEN_SECRET=alohomora123!
TOKEN_SECRET_TEST=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoxLCJmaXJzdG5hbWUiOiJKb2huIiwibGFzdG5hbWUiOiJEb2UiLCJ1c2VybmFtZSI6InRlc3QiLCJwYXNzd29yZF9kaWdlc3QiOiIkMmIkMTAkeXNkTHQuUjVqdjFJdHVzTk5NMGJNLlU0RkZvbmJRYUV2VFBsVnFhQWJqSkV3NTdzTEZwVGEifSwiaWF0IjoxNjUzMjUzODIxfQ.rdC42gcdhzAwnwwVJxmhBLVK5tvf2zONG3UcHLU6xE0`
```
- Inside shelf folder mount the container: `docker compose up`
- Create shelf_test database with the following commands:
-- `docker exec -it shelf-postgres-1 /bin/bash`
-- `psql -U postgres`
-- `CREATE DATABASE shelf_test`
# Installation
1 - Install packages dependencies. `npm install`
2 - Inside shelf folder mount the database. `docker compose up`
3 - Run tests. `npm run test`
4 - Run the database `npm run up`
5 - Launch the application `npm run start`
- Install packages dependencies: `npm install`
- Run tests: `npm run test`
- Run the database: `npm run up`
- Launch the application: `npm run start`
Note : If needed you can reset the tables by closing the app and running the following commands :
Note : If needed you can reset the tables by closing the app and running the following commands:
- `npm run down`
- `npm run up`
@ -53,14 +75,15 @@ Note : If needed you can reset the tables by closing the app and running the fol
# Built with
- Typescript
- Postgres
- Node
- Express
- Dotenv
- Docker
- Postgres
- Db-migrate
- Jsonwebtoken
- Jasmine
- Supertest
- Supertest
# Author