To use the API, follow the steps below.
-
Run the command below to install
node_modules
.npm i
-
After the
node_modules
folder has been installed, check thepackage.json
file for the dependencies and devDependencies and install them as follows.- You can use either
npm
oryarn
for installation. - If you use
yarn
as your package installer, follow step 1, if you usenpm
, follow step 2:-
Installing the dependencies
yarn add bcrypt body-parser cors jasmine jasmine-spec-reporter jsonwebtoken morgan nodemon pg express dotenv db-migrate db-migrate-pg
Installing the devDependencies
yarn add --dev typescript ts-node tsc-watch prettier jasmine-ts eslint-plugin-prettier eslint-config-prettier eslint @types/node @types/bcrypt @types/body-parser @types/cors @types/express @types/jasmine @types/jsonwebtoken @types/morgan @types/nodemon @types/pg @typescript-eslint/eslint-plugin @typescript-eslint/parser
-
Installing the dependencies
npm i bcrypt body-parser cors jasmine jasmine-spec-reporter jsonwebtoken morgan nodemon pg express dotenv db-migrate db-migrate-pg
Installing the devDependencies
npm i -D typescript ts-node tsc-watch prettier jasmine-ts eslint-plugin-prettier eslint-config-prettier eslint @types/node @types/bcrypt @types/body-parser @types/cors @types/express @types/jasmine @types/jsonwebtoken @types/morgan @types/nodemon @types/pg @typescript-eslint/eslint-plugin @typescript-eslint/parser
-
- You can use either
-
The
tsconfig.json
,eslint.json
and.prettierrc
are already configured for you. Don't worry about that. -
BACKEND PORT =
3000
, DATABASE PORT =5432
. -
Use the
.env.example
to create a.env
file with your own values for sensitive info and some from thedatabase.json
file. -
Creating user
CREATE USER store_manager WITH PASSWORD 'password123';
Creating databases
CREATE DATABASE store; CREATE DATABASE store_test;
Granting privileges to user
GRANT ALL PRIVILEGES ON DATABASE store TO store_manager; GRANT ALL PRIVILEGES ON DATABASE store_test TO store_manager;
- This will be simple, just run the command below and watch.
npm run test // FOR NPM yarn test //FOR YARN
- You should see this as the results.