Skip to content

ocknamo/monacardjs

Repository files navigation

monacardjs

Description

Nodejs implementation of Monacard. It uses JavaScript, is built with TypeScript. This is implemented with reference to the MonacardHub.

Installation

$ yarn install --frozen-lockfile

DB

Start mysql DB for local.

// Start docker.
$ yarn docker:up

// initialize schema.
$ yarn init:db

Stop mysql DB.

$ yarn docker:down

Migration

Generate

$ yarn migration:generate

Run.

$ yarn migration:run

Revert previous migration.

$ yarn migration:revert

Show migration history.

$ yarn migration:show

Running the app

# development
$ yarn start

# watch mode
$ yarn start:dev

# production mode
$ yarn start:prod

When development or watch mode you can test api at http://localhost:3000/api.

Running the worker

Worker is not nestjs application. So you can run it as just JavaScript or TypeScript script.

read-new-monacard

// example
$ yarn build
$ node ./dist/src/worker/app/read-new-monacard.js

sync-ban-card-list

// example
$ yarn build
$ node ./dist/src/worker/app/sync-ban-card-list.js

Setting of environment value

Create .env file in root directory from .env.org.

Hint: This application uses dotenv.

Test

# prepare
$ yarn docker:up
$ yarn init:db

# unit tests
$ yarn test

# e2e tests
$ yarn test:e2e

# test coverage
$ yarn test:cov

lint and format

# lint by eslint
$ yarn lint

# format
$ yarn format

Build docker image

$ docker image build -t example/monacardjs:0.0.1 .

License

MIT licensed.