This project uses NodeJs, express and postgres SQL. CRUD actions are available for all tables.
New users can signUp and Login and create new orders. Admin can create, update and delete products, orders and users.
To run and access all functionalities navigate to localhost:3000/
enter the valid parmeters and HTTP request method(POST, GET, PUT, DELETE).
The project can be built and run in the following ways
npm i
npm run build
This command will build the typeScript code into JavaScript and save them in the ./build
folder.
npm run start
(For Development)
AND
npm run start:prod
(For Production)
This command will start the server running on port 3000
.
- -> Check
Package.json
for information.
Here, I will show you how to run the test and also how to check that our code respects all the eslint rules.
npm run format
This script contains formating and linting the application.
npm run test
This script sets ENV=test
and runs migrations to reset and create test database and tables, then builds the application and runs testing using jasmine.
ENV=dev
PORT=3000
DB_HOST=localhost
DB_PORT=5432
DB_DATABASE=database_dev
DB_DATABASE_TEST=database_test
DB_USER=postgres
DB_PASS=admin
BCRYPT_PASSWORD=your-secret-password
SALT_ROUNDS=10
TOKEN_SECRET=your-secret-token
# Tokens are passed along with the http header as
Authorization Bearer <token>
# Database
CREATE DATABASE database_dev;
CREATE DATABASE database_test;
# Migrations used to Create a Tables in Database
db-migrate up
# Migrations used to make Drop a Tables in Database
db-migrate down
# Migrations used in this project
db-migrate create add-users-table --sql-file
db-migrate create add-products-table --sql-file
db-migrate create add-orders-table --sql-file
db-migrate create add-ordered-products-table --sql-file
- NodeJS - The JavaScript runtime.
- Express - The web framework.
- TypeScript - The language used.
- Jasmine - The Testing framework used.
- PostgreSql - The database used
- Postman - The program used to build and test my APIs