Steps to run this project:
- Run
yarn
- Run
yarn run typeorm migration:create -n CreateAdminUser
- File inside
src/migration
was created - Replace
up
function by
public async up(queryRunner: QueryRunner): Promise<any> {
const user = new User();
user.username = 'admin';
user.password = 'admin';
user.hashPassword();
user.role = 'ADMIN';
const userRepository = getRepository(User);
await userRepository.save(user);
}
- Add inside the same file
import {getRepository, MigrationInterface, QueryRunner} from "typeorm";
import {User} from "../entity/User";
Tip
Change the password :)
- Run
docker-compose build && docker-compose up -d
command - Api will be available on
localhost:3000
- Api logs will be avaible on
http://localhost:3000/swagger-stats/ui