A simple CLI for create koa + ts project: koats create myProject
.
koats provide three templates that are all based on ts.
-
This is a basic of koa project structure, integrated with ts. If you want to custom the structure of the project, this template is for you.
For more details, please see https://github.com/SimpleCodeCX/koa-ts-base-template
-
This is a full project structure, integrated with ts.This project has been configured with a mysql database, support different environment(dev,prod,testing) configuration, some custom koa middleware have configured, and it has been the definition of a unified api response format.
For more details, please see https://github.com/SimpleCodeCX/koa-ts-full-template
-
This is a full-stack project structure based on koa-ts-full-template.
It contains three parts:
- client: This directory is the front-end code.
- server: This directory is the back-end code.
- common: This directory is the common code for front-end and back-end.
For more details, please see https://github.com/SimpleCodeCX/koa-ts-full-stack-server
This three template has the following three common features.
✓ koa v2
✓ Jest
✓ APIDOC
✓ Docker
✓ Eslint
✓ Husky
npm i -g koa-ts-cli
koats create myProject
# Choose your favorite template.
cd myProject
npm install
cd myProject
npm run dev
NOTE: If you choose koa-ts-full-template or koa-ts-full-stack-template, you need to do some configuration.
npm run build
cd myProject/dist
npm run prod
NOTE: If you choose koa-ts-full-template or koa-ts-full-stack-template, you need to do some configuration.
cd myProject
npm install
npm run build
sudo docker build -t koa-ts-api-server .
sudo docker run -it --name koa-ts-api-server -p 8080:8080 koa-ts-api-server
cd myProject
npm run test