Clone the repository
git clone https://github.com/ozgursolak/crea.git
Switch to the repo folder
cd crea-assignment
Install dependencies
npm install
Create config file and set the JsonWebToken private key
The codebase contains database abstractions, namely TypeORM.
The branch main
implements TypeORM with a postgreSQL database.
Create a new postgresql database with the name crea
(or the name you specified in the ormconfig.json)
Set postgresql database settings in ormconfig.json
{
"type": "postgres",
"host": "localhost",
"port": 5432,
"username": "postgres",
"password": "12345",
"database": "crea",
"entities": ["dist/**/*.entity.js"],
"synchronize": true
}
Start local mysql server and create new database 'crea'
On application start, tables for all entities will be created.
npm start
- Start applicationnpm run start:watch
- Start application in watch modenpm run start:prod
- Build application
This application adheres to the api specifications set by the OpenAPI.
npm start
- Test apis with Postman or directly on swagger.
- NOTE: Required postman collection is added to the repository. (crea.postman_collection.json)
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 authorization and role guards handle the validation and authentication of the token.
This repo uses the NestJS swagger module for API documentation. The swagger document is served in (https://localhost:3000/docs)