|
1 | | -# typescript-node [](https://travis-ci.org/Talento90/typescript-node) |
| 1 | +# typescript-node [](https://travis-ci.org/Talento90/typescript-node) [](https://codecov.io/gh/Talento90/typescript-node) |
2 | 2 |
|
3 | | -Boilerplate template for node and typescript services. |
4 | 3 |
|
5 | | -## Deprecated |
6 | | -Please for an updated version look at this repository: https://github.com/dwyl/hapi-typescript-example |
| 4 | +Template for building nodejs and typescript services. The main goal of this boilerplate is to offer a good Developer Experience (eg: debugging, watch and recompile) by providing the following features out of the box: |
7 | 5 |
|
| 6 | +***Features*** |
8 | 7 |
|
9 | | -**Installation** |
| 8 | +* Language - [TypeScript](https://www.typescriptlang.org/) |
| 9 | +* REST API - [koa2](http://koajs.com/) |
| 10 | +* Graceful Shutdown - [Pattern](https://nemethgergely.com/nodejs-healthcheck-graceful-shutdown/) |
| 11 | +* HealthCheck - [Patern /health](http://microservices.io/patterns/observability/health-check-api.html) |
| 12 | +* SQL Database & Migrations - [knex](http://knexjs.org/) |
| 13 | +* Authentication and Authorization - [JWT Tokens](https://github.com/auth0/node-jsonwebtoken) |
| 14 | +* Validation - [Joi](https://github.com/hapijs/joi) |
| 15 | +* Testing - [Mocha](https://mochajs.org/) [Chai](http://www.chaijs.com/) + [Sinon](http://sinonjs.org/) [Coverage](https://istanbul.js.org/) |
| 16 | +* Code Style - [Prettier](https://prettier.io/) |
| 17 | +* Git Hooks - [Husky](https://github.com/typicode/husky) |
10 | 18 |
|
11 | | -* *npm run setup* (install nuget packages & typings) |
| 19 | +## Installation & Run |
12 | 20 |
|
13 | | -**Run** |
| 21 | +* *npm install* - Install dependencies |
| 22 | +* *npm run start* - Start application (It needs a mysql database) |
14 | 23 |
|
15 | | -* *gulp build* (build ts files) |
16 | | -* *gulp test* (run mocha tests) |
17 | | -* *gulp tslint* (run tslint) |
18 | | -* *gulp watch* (watch ts files) |
19 | | -* *npm run start* (start the application) |
20 | | -* *npm run watch* (restart the application when files change) |
21 | | -* *npm start* (run the application on http://localhost:5000/api/docs) |
| 24 | +### Running with Docker |
22 | 25 |
|
23 | | -**Docker** |
24 | | -* *docker-compose build* (compose images) |
25 | | -* *docker-compose up* (running containers) |
26 | | -* *browser: http://localhost:8080/docs* (have fun :) |
| 26 | +* *docker-compose up* (compose and run, it also creates the mysql database) |
| 27 | +* *docker-compose down* (Destroy application and mysql containers) |
27 | 28 |
|
28 | | -**Features** |
| 29 | +## Useful npm commands |
29 | 30 |
|
30 | | -* *Project Structure - Feature oriented* |
31 | | -* *Hapijs - REST Api* |
32 | | -* *Swagger - documentation* |
33 | | -* *Jwt - authentication* |
34 | | -* *Mongoose - MongoDb* |
35 | | -* *nconf - configurations* |
36 | | -* *Unit Tests - chai + sinon + mocha* |
37 | | - |
38 | | -Have fun :) |
| 31 | +* *npm run build* - Transpile TypeScript code |
| 32 | +* *npm run clean* - Remove dist, node_modules, coverage folders |
| 33 | +* *npm run coverage* - Run NYC coverage |
| 34 | +* *npm run lint* - Lint your TypeScript code |
| 35 | +* *npm run start:dev* - Run application in dev mode (debug & watch). Debug mode is running on port 5858 (open `chrome://inspect/#devices`). |
| 36 | +* *npm run test* - Run unit tests |
| 37 | +* *npm run test:integration* - Run integration tests |
| 38 | +* *npm run test:all* - Run Unit and Integration tests |
0 commit comments