Minimalistic boilerplate to jump-start a Koa2 project in TypeScript [v2.9].
Provides a basic template, "batteries included":
- Koa2, koa-router, koa-bodyparser and their type definitions
- TypeScript to ES6 transpilation,
- TSLint 5.x with Microsoft recommended rules,
- Jest unit testing and code coverage,
- Type definitions for Node.js v8+ and Jest,
- NPM scripts for common operations,
- a simple example of TypeScript code and unit test,
- .editorconfig for consistent file format.
This project is intended to be used with v8 (LTS Carbon) release of Node.js or newer and NPM. Make sure you have those installed.
$ git clone https://github.com/jerrywdlee/koa-typescript-boilerplate.git
$ cd koa-typescript-boilerplate
$ npm i
$ npm run watch
Now start adding your code in the src
and unit tests in the __tests__
directories. Have fun and build amazing things 🚀
Writing unit tests in TypeScript can sometimes be troublesome and confusing. Especially when mocking dependencies and using spies.
clean
- remove coverage data, Jest cache and transpiled files,dev
- runapp.ts
directly by ts-node,ts
||repl
- run typescrip REPL for node.js,build
- transpile TypeScript to ES6,watch
- watch change from/src
, lint, build and restart app,lint
- lint source files and tests,test
- run tests,test:watch
- interactive watch mode to automatically re-run tests
This project is Powered By node-typescript-boilerplate