Reviews play a vital role in the world today when someone decides what services or product one want to consume.
Clone the repository
git clone https://github.com/willypelz/cr-system-be.git
Switch to the repo folder
cd cr-system-be
Install dependencies
npm install
Copy config file and set JsonWebToken secret key
cp src/config.ts.example src/config.ts
The system uses a database abstractions, namely TypeORM.
Create a new mysql database with the name company_review
(or the name you specified in the ormconfig.json)
Copy TypeORM config example file for database settings
cp ormconfig.json.example
Set mysql database settings in ormconfig.json
{
"type": "mysql",
"host": "localhost",
"port": 3306,
"username": "your-mysql-username",
"password": "your-mysql-password",
"database": "company_review",
"entities": ["src/**/**.entity{.ts,.js}"],
"synchronize": true
}
Start local mysql server and create new database 'company_review'
On application start, tables for all entities will be created.
###Set an admin for the application seed this information into the database or change any role user you wish to be admin to admin for testing and due to the time constrain.
{
"username": "admin"
"email": "[email protected]",
"password": "password",
"role": "admin"
}
npm start
- Start applicationnpm run start:watch
- Start application in watch modenpm run test
- run Jest test runnernpm run start:prod
- Build application
npm start
- Test api with
http://localhost:3000/api/companies
in your favourite browser
This applications uses JSON Web Token (JWT) to handle authentication. The token is passed with each request using the Authorization
header with Token
scheme. The JWT authentication middleware handles the validation and authentication of the token. Please check the following sources to learn more about JWT.
This application documentation can be access through /docs
http://localhost:3000/docs