A quickstart template for TypeScript + Koa 2
- TypeScript + Koa 2
- Auto scan routes, configure routes using
@Controller('/path')
above class, and@Post('/subPath')
above each function ( other HTTP methods are also supported )
- Node.js latest v10.x or newer
- PostgreSQL ( if you use MySQL, need to configure right driver for knex, and disable PostGraphile manually )
- first things first, input postgres configurations in
conf/local
- then:
npm install
npm run n (dev mode)
open http://localhost:3000/test/2
( or, open http://localhost:3000/test/1 , you should ensure you have a table named `user_tb` first )
-----------------------------------------------------------
npm run build ( use tsc to build codes for production )
npm start (run compiled codes for production)
- TypeScript + its decorators + reflect-metadata
- Koa 2
- Knex.js , a SQL query builder
- pg , Postgresql Nodejs driver
- PostGraphile , make GraphQL and Postgres things easy
- dotenv , configurations in .env files
- nodemon , auto restart node when code changes
- ts-node , execute .ts files without building to .js
- eslint , typescript-eslint ( TSLint is deprecated )
- concurrently , run multiple commands at one time
- open-cli , open URL in browser, through terminal.
inspired by:
https://github.com/midwayjs/midway/
Other similar projects:
https://github.com/thinkkoa/koatty