An API that serve an online store
Practiced in this project:
- Architect the database, its tables, and columns to fulfill the data requirements
- Craft a RESTful API that exposes that information to the frontend of an online store.
npm install
you must create 2 databases one for development and one for test
-
Linux
Logging in to root PostgreSQL user account
sudo -i -u postgres
then type
psql
-
windows:
psql -U postgres
-
create store_usr with password e.g. 123456
postgres=#
create user - create store_usr with encrypted password '123456';
- create store database
CREATE DATABASE store;
- create store_test database
CREATE DATABASE store_test;
grant all privileges on database store to store_usr;
grant all privileges on database store_test to store_usr;
you must have a .env
file
ENV=<VALUE>
POSTGRES_HOST=<VALUE>
POSTGRES_PORT=<VALUE>
POSTGRES_DB=<VALUE>
POSTGRES_TEST_DB=<VALUE>
POSTGRES_USER=<VALUE>
POSTGRES_PASSWORD=<VALUE>
BCRYPT_PASSWORD=<VALUE>
SALT_ROUNDS=<VALUE>
TOKEN_SECRET=<VALUE>
to run test npm run test
you can create user on '/users/' [POST] structure
{
"first_name": "<value>",
"last_name": "<value>",
"user_name": "<value>",
"password": "<value>"
}
user_name must be unique per uesr