Starter project for using koa with TypeScript and TypeORM
- Node 10 or higher (you can try to manage your versions using nvm)
- Yarn package manager or you need to generate
package-lock.json
by yourself
-
Set up your database and make sure you change the config to your own setup. You can find your database config under
config/ormconfig.json
for your development environment. Change accordingly to your chosen environment (development/test/production){ "type": "postgres", "host": "localhost", "port": 5432, "username": "username", "password": "password", "database": "database", "logging": false }
For more info like supported database driver visit TypeORM.
-
And start your application by running this in the terminal. This would watch for changes and rebuild(transpiled) your application
$ npm run debug
With that, you can see in your terminal and logs that the app is ready to listen for requests. For example:
[2018-06-04T01:55:18.426Z] [info]: Server started at http://localhost:3000 NODE_ENV=development
For run in production run this in terminal:
$ npm run start
If you want to use pm2 check it's config in
ecosystem.config.json
and the run:$ npm run pm2
Also if you run on production don't forget to check logs in dirname/logs
to make sure that the startup is successful
To run the test suites, type in your terminal
$ npm run test
Or per test type
$ npm run e2e:test
$ npm run unit:test
- Routing controllers - Web framework
- TypeORM - Database Management
- TypeDI - Dependencies injection
Open for pull requests!
Big thanks to JM Santos for similar Express starter