A simple koa ts quickstarter
- docker and docker compose (lastest version) Docker & Docker-Compose
- git clone https://github.com/mowaiskalam/koa2-typeorm-boilerplate.git and go to project folder.
- create .env file in config directory
npm install
(install packages locally, since we don't mount node_modules in container)npm run build:docker
npm run start:docker
A collection of useful commands which might be helpful
npm run logs
npm run lint
npm run lint:fix
npm run format:check
npm run format:fix:all
npm run test
- uncomment following line from docker-compose.yml
#- --inspect-brk=0.0.0.0
- create launch.json in .vscode folder, and copy following code
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Docker: Attach to Node",
"port": 9229,
"address": "localhost",
"localRoot": "${workspaceFolder}/src",
"remoteRoot": "/api/src",
"protocol": "inspector"
}
]
}
NODE_ENV=local
PORT=4001
CONN_NAME=default
TYPEORM_CONNECTION=postgres
TYPEORM_HOST=postgres
TYPEORM_USERNAME=postgres
TYPEORM_PASSWORD=postgres
TYPEORM_DATABASE=nodejs101
TYPEORM_PORT=5432
TYPEORM_ENTITIES=src/entities/**/*.ts
TYPEORM_MIGRATIONS=database/migrations/**/*.ts
TYPEORM_ENTITIES_DIR=src/entities
TYPEORM_MIGRATIONS_DIR=database/migrations
TYPEORM_DRIVER_EXTRA={"max":100}