A platform which allows an office worker at a car rental company to make new contracts and return borrowed cars
The instructions below will get you a copy of the project and allow you to run it on your local machine for development and testing purposes.
First clone this repository to your local machine. If you are not familiar with the process, please refer tо github's instructions on the topic.
For this project, we need to create a database with a docker and Postgres. If you already have a docker engine installed, you can directly continue with the process guidlines below. Otherwise, please follow the official documentation for your operating system and get familiar with postgres in docker images.
We recommend you to follow the Automated Process Guidline below. If you would like to set everything yourself, you can refer to the Manual Process Guidline.
Open a terminal in the root directory (folder rentalcar).
Run the following command: ./start.sh
custom_postgres
, the password and username which are currently set to atscale
. Please note that you will need them in steps 6 and 7. docker run --name custom_postgres -p 5432:5432 -e POSTGRES_PASSWORD=atscale -e POSTGRES_USER=atscale -d postgres:11.5
You will need to start the image. Please repeat the command every time the computer is restarted.
docker container start addImageIdHere
After the repository is successfully cloned (step 1), navigate to the server folder.
In the server folder, create .env file. It contains sensitive data about your server. In the .env file, you can set your username, password and database name by changing YOUR_USERNAME
, YOUR_PASSWORD
and public
in the example below. They should match the ones you chose in step 3.
DB_TYPE = postgres
DB_HOST = localhost
DB_PORT = 5432
DB_USERNAME = YOUR_USERNAME
DB_PASSWORD = YOUR_PASSWORD
DB_DATABASE_NAME = public
{
"type": "postgres",
"host": "localhost",
"port": 5432,
"username": "YOUR_USERNAME",
"password": "YOUR_PASSWORD",
"database": "postgres",
"synchronize": "false",
"entities": [
"src/database/entities/**/*.ts"
],
"migrations": [
"src/database/migration/**/*.ts"
],
"cli": {
"entitiesDir": "src/database/entities",
"migrationsDir": "src/database/migration"
}
}
npm install
npm run typeorm:run // runs the migration to the database
npm run seed // it will enter basic data in the database
npm run start // it will start the server
Having successfully run the server, you can run the application:
Navigate to the client folder
Open the terminal there and run the following commands:
npm install
npm start
In order to run the tests on the server, navigate to the server folder and run the command below:
npm test
Navigate to the client folder and run he following command:
npm test
Navigate to the client folder and run he following command:
./node_modules/.bin/nightwatch tests/nightwatchTest.js
Stanislav Trifonov
This project is licensed under the MIT License