typescript-express-starter 8.1.7 → 9.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.kr.md +5 -6
  2. package/README.md +5 -4
  3. package/lib/default/package.json +7 -10
  4. package/lib/default/src/http/auth.http +0 -5
  5. package/lib/default/swagger.yaml +0 -3
  6. package/lib/graphql/.env.development.local +1 -1
  7. package/lib/graphql/.env.production.local +1 -1
  8. package/lib/graphql/package.json +6 -9
  9. package/lib/knex/.env.development.local +1 -1
  10. package/lib/knex/.env.production.local +1 -1
  11. package/lib/knex/package.json +21 -24
  12. package/lib/knex/src/http/auth.http +0 -5
  13. package/lib/knex/swagger.yaml +0 -3
  14. package/lib/mikro-orm/.dockerignore +18 -0
  15. package/lib/mikro-orm/.editorconfig +9 -0
  16. package/lib/mikro-orm/.env.development.local +18 -0
  17. package/lib/mikro-orm/.env.production.local +18 -0
  18. package/lib/mikro-orm/.env.test.local +18 -0
  19. package/lib/mikro-orm/.eslintignore +1 -0
  20. package/lib/mikro-orm/.eslintrc +18 -0
  21. package/lib/mikro-orm/.huskyrc +5 -0
  22. package/lib/mikro-orm/.lintstagedrc.json +5 -0
  23. package/lib/mikro-orm/.prettierrc +8 -0
  24. package/lib/mikro-orm/.swcrc +41 -0
  25. package/lib/mikro-orm/.vscode/launch.json +35 -0
  26. package/lib/mikro-orm/.vscode/settings.json +6 -0
  27. package/lib/mikro-orm/Dockerfile +24 -0
  28. package/lib/mikro-orm/Makefile +29 -0
  29. package/lib/mikro-orm/docker-compose.yml +46 -0
  30. package/lib/mikro-orm/ecosystem.config.js +57 -0
  31. package/lib/mikro-orm/jest.config.js +12 -0
  32. package/lib/mikro-orm/nginx.conf +40 -0
  33. package/lib/mikro-orm/nodemon.json +12 -0
  34. package/lib/mikro-orm/package.json +77 -0
  35. package/lib/mikro-orm/src/app.ts +98 -0
  36. package/lib/mikro-orm/src/config/index.ts +5 -0
  37. package/lib/mikro-orm/src/controllers/auth.controller.ts +46 -0
  38. package/lib/mikro-orm/src/controllers/index.controller.ts +13 -0
  39. package/lib/mikro-orm/src/controllers/users.controller.ts +65 -0
  40. package/lib/mikro-orm/src/databases/index.ts +19 -0
  41. package/lib/mikro-orm/src/dtos/users.dto.ts +9 -0
  42. package/lib/mikro-orm/src/entities/base.entity.ts +16 -0
  43. package/lib/mikro-orm/src/entities/users.entity.ts +17 -0
  44. package/lib/mikro-orm/src/exceptions/HttpException.ts +10 -0
  45. package/lib/mikro-orm/src/http/auth.http +32 -0
  46. package/lib/mikro-orm/src/http/users.http +34 -0
  47. package/lib/mikro-orm/src/interfaces/auth.interface.ts +15 -0
  48. package/lib/mikro-orm/src/interfaces/routes.interface.ts +6 -0
  49. package/lib/mikro-orm/src/interfaces/users.interface.ts +5 -0
  50. package/lib/mikro-orm/src/middlewares/auth.middleware.ts +32 -0
  51. package/lib/mikro-orm/src/middlewares/error.middleware.ts +17 -0
  52. package/lib/mikro-orm/src/middlewares/validation.middleware.ts +25 -0
  53. package/lib/mikro-orm/src/routes/auth.route.ts +24 -0
  54. package/lib/mikro-orm/src/routes/index.route.ts +19 -0
  55. package/lib/mikro-orm/src/routes/users.route.ts +25 -0
  56. package/lib/mikro-orm/src/server.ts +11 -0
  57. package/lib/mikro-orm/src/services/auth.service.ts +63 -0
  58. package/lib/mikro-orm/src/services/users.service.ts +68 -0
  59. package/lib/mikro-orm/src/tests/auth.test.ts +66 -0
  60. package/lib/mikro-orm/src/tests/index.test.ts +18 -0
  61. package/lib/mikro-orm/src/tests/users.test.ts +70 -0
  62. package/lib/mikro-orm/src/utils/logger.ts +65 -0
  63. package/lib/mikro-orm/src/utils/util.ts +19 -0
  64. package/lib/mikro-orm/src/utils/validateEnv.ts +10 -0
  65. package/lib/mikro-orm/swagger.yaml +122 -0
  66. package/lib/mikro-orm/tsconfig.json +41 -0
  67. package/lib/mongoose/.env.development.local +1 -1
  68. package/lib/mongoose/.env.production.local +1 -1
  69. package/lib/mongoose/package.json +5 -8
  70. package/lib/mongoose/src/http/auth.http +0 -5
  71. package/lib/mongoose/swagger.yaml +0 -2
  72. package/lib/prisma/.env.development.local +1 -1
  73. package/lib/prisma/.env.production.local +1 -1
  74. package/lib/prisma/package.json +5 -8
  75. package/lib/prisma/src/http/auth.http +0 -5
  76. package/lib/prisma/swagger.yaml +0 -3
  77. package/lib/routing-controllers/package.json +6 -8
  78. package/lib/routing-controllers/src/http/auth.http +0 -5
  79. package/lib/sequelize/.env.development.local +1 -1
  80. package/lib/sequelize/.env.production.local +1 -1
  81. package/lib/sequelize/package.json +5 -8
  82. package/lib/sequelize/src/http/auth.http +0 -5
  83. package/lib/sequelize/swagger.yaml +0 -3
  84. package/lib/typegoose/.env.development.local +1 -1
  85. package/lib/typegoose/.env.production.local +1 -1
  86. package/lib/typegoose/package.json +4 -7
  87. package/lib/typegoose/src/http/auth.http +0 -5
  88. package/lib/typegoose/swagger.yaml +0 -2
  89. package/lib/typeorm/.env.development.local +1 -1
  90. package/lib/typeorm/.env.production.local +1 -1
  91. package/lib/typeorm/package.json +4 -7
  92. package/lib/typeorm/src/http/auth.http +0 -5
  93. package/lib/typeorm/swagger.yaml +0 -3
  94. package/package.json +6 -15
package/README.kr.md CHANGED
@@ -103,7 +103,7 @@ $ npx typescript-express-starter "project name"
103
103
  | [Knex](https://github.com/knex/knex) | 쿼리 빌더를 위한 라이브러리 |
104
104
  | [GraphQL](https://github.com/graphql/graphql-js) | API 용 쿼리 언어이며 기존 데이터로 이러한 쿼리를 수행하기위한 런타임 |
105
105
  | [Typegoose](https://github.com/typegoose/typegoose) | 타입스크립트 클래스를 사용하여 몽구스 모델 정의 |
106
- | [Mikro ORM](https://github.com/mikro-orm/mikro-orm) (개발중) | 데이터 매퍼, 작업 단위 및 아이덴티티 맵 패턴을 기반으로 하는 Node.js용 TypeScript ORM. MongoDB, MySQL, MariaDB, PostgreSQL 및 SQLite 데이터베이스를 지원 |
106
+ | [Mikro ORM](https://github.com/mikro-orm/mikro-orm) | 데이터 매퍼, 작업 단위 및 아이덴티티 맵 패턴을 기반으로 하는 Node.js용 TypeScript ORM. MongoDB, MySQL, MariaDB, PostgreSQL 및 SQLite 데이터베이스를 지원 |
107
107
  | [Sequelize Typescript](https://github.com/RobinBuschmann/sequelize-typescript) (개발중) | 데코레이터 및 Sequelize를 위한 몇 가지 기능 |
108
108
 
109
109
  ## 🛎 Script 명령어
@@ -235,10 +235,8 @@ VSCode Extension에서 [REST Client](https://marketplace.visualstudio.com/items?
235
235
  │ └── settings.json
236
236
 
237
237
  ├── /src
238
- │ ├── /configs
239
- │ │ ├── development.json
240
- │ │ ├── production.json
241
- │ │ └── test.json
238
+ │ ├── /config
239
+ │ │ └── index.ts
242
240
  │ │
243
241
  │ ├── /controllers
244
242
  │ │ ├── auth.controller.ts
@@ -288,7 +286,6 @@ VSCode Extension에서 [REST Client](https://marketplace.visualstudio.com/items?
288
286
  │ │ └── vaildateEnv.ts
289
287
  │ │
290
288
  │ ├── app.ts
291
- │ ├── index.ts
292
289
  │ └── server.ts
293
290
 
294
291
  ├── .dockerignore
@@ -372,6 +369,8 @@ VSCode Extension에서 [REST Client](https://marketplace.visualstudio.com/items?
372
369
 
373
370
  - JagTheFriend [JagTheFriend](https://github.com/JagTheFriend)
374
371
 
372
+ - Tamzid Karim [Tamzid Karim](https://github.com/tamzidkarim)
373
+
375
374
  ## 💳 라이센스
376
375
 
377
376
  [MIT](LICENSE)
package/README.md CHANGED
@@ -107,7 +107,7 @@ Start your typescript-express-starter app in development mode at `http://localho
107
107
  | [Knex](https://github.com/knex/knex) | SQL query builder for Postgres, MySQL, MariaDB, SQLite3 and Oracle |
108
108
  | [GraphQL](https://github.com/graphql/graphql-js) | query language for APIs and a runtime for fulfilling those queries with your existing data |
109
109
  | [Typegoose](https://github.com/typegoose/typegoose) | Define Mongoose models using TypeScript classes |
110
- | [Mikro ORM](https://github.com/mikro-orm/mikro-orm) (Develop) | TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL and SQLite databases |
110
+ | [Mikro ORM](https://github.com/mikro-orm/mikro-orm) | TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL and SQLite databases |
111
111
  | [Sequelize Typescript](https://github.com/RobinBuschmann/sequelize-typescript) (Develop) | Decorators and some other features for sequelize |
112
112
 
113
113
  ## 🛎 Available Commands for the Server
@@ -240,8 +240,8 @@ Modify `.swcrc` file to your source code.
240
240
  │ └── settings.json
241
241
 
242
242
  ├── /src
243
- │ ├── /configs
244
- │ │ ├── index.ts
243
+ │ ├── /config
244
+ │ │ └── index.ts
245
245
  │ │
246
246
  │ ├── /controllers
247
247
  │ │ ├── auth.controller.ts
@@ -291,7 +291,6 @@ Modify `.swcrc` file to your source code.
291
291
  │ │ └── vaildateEnv.ts
292
292
  │ │
293
293
  │ ├── app.ts
294
- │ ├── index.ts
295
294
  │ └── server.ts
296
295
 
297
296
  ├── .dockerignore
@@ -377,6 +376,8 @@ Modify `.swcrc` file to your source code.
377
376
 
378
377
  - JagTheFriend [JagTheFriend](https://github.com/JagTheFriend)
379
378
 
379
+ - Tamzid Karim [Tamzid Karim](https://github.com/tamzidkarim)
380
+
380
381
  ## 💳 License
381
382
 
382
383
  [MIT](LICENSE)
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "bcrypt": "^5.0.1",
20
- "class-transformer": "^0.4.0",
20
+ "class-transformer": "^0.5.1",
21
21
  "class-validator": "^0.13.1",
22
22
  "compression": "^1.7.4",
23
23
  "cookie-parser": "^1.4.5",
@@ -41,18 +41,15 @@
41
41
  "@types/compression": "^1.7.1",
42
42
  "@types/cookie-parser": "^1.4.2",
43
43
  "@types/cors": "^2.8.11",
44
- "@types/dotenv": "^8.2.0",
45
44
  "@types/express": "^4.17.13",
46
- "@types/helmet": "^4.0.0",
47
45
  "@types/hpp": "^0.2.1",
48
- "@types/jest": "^26.0.24",
46
+ "@types/jest": "27.4.x",
49
47
  "@types/jsonwebtoken": "^8.5.4",
50
48
  "@types/morgan": "^1.9.3",
51
49
  "@types/node": "^16.0.1",
52
50
  "@types/supertest": "^2.0.11",
53
51
  "@types/swagger-jsdoc": "^6.0.1",
54
52
  "@types/swagger-ui-express": "^4.1.3",
55
- "@types/winston": "^2.4.4",
56
53
  "@typescript-eslint/eslint-plugin": "^4.28.2",
57
54
  "@typescript-eslint/parser": "^4.28.2",
58
55
  "cross-env": "^7.0.3",
@@ -60,18 +57,18 @@
60
57
  "eslint-config-prettier": "^8.3.0",
61
58
  "eslint-plugin-prettier": "^3.4.0",
62
59
  "husky": "^7.0.1",
63
- "jest": "^27.0.6",
60
+ "jest": "27.4.x",
64
61
  "lint-staged": "^11.0.0",
65
62
  "node-config": "^0.0.2",
66
63
  "node-gyp": "^8.1.0",
67
64
  "nodemon": "^2.0.9",
68
65
  "pm2": "^5.1.0",
69
66
  "prettier": "^2.3.2",
70
- "supertest": "^6.1.3",
67
+ "supertest": "^6.2.2",
68
+ "ts-jest": "^27.1.4",
69
+ "ts-node": "^10.4.0",
71
70
  "tsc-alias": "^1.4.1",
72
71
  "tsconfig-paths": "^3.10.1",
73
- "ts-jest": "^27.0.3",
74
- "ts-node": "^10.0.0",
75
- "typescript": "^4.3.5"
72
+ "typescript": "^4.5.2"
76
73
  }
77
74
  }
@@ -25,8 +25,3 @@ Content-Type: application/json
25
25
  # User Logout
26
26
  POST {{ baseURL }}/logout
27
27
  Content-Type: application/json
28
-
29
- {
30
- "email": "example@email.com",
31
- "password": "password"
32
- }
@@ -111,9 +111,6 @@ definitions:
111
111
  - email
112
112
  - password
113
113
  properties:
114
- id:
115
- type: integer
116
- description: user Id
117
114
  email:
118
115
  type: string
119
116
  description: user Email
@@ -6,7 +6,7 @@ DB_HOST = localhost
6
6
  DB_PORT = 5432
7
7
  DB_USER = root
8
8
  DB_PASSWORD = password
9
- DB_DATABASE = test
9
+ DB_DATABASE = dev
10
10
 
11
11
  # TOKEN
12
12
  SECRET_KEY = secretKey
@@ -6,7 +6,7 @@ DB_HOST = localhost
6
6
  DB_PORT = 5432
7
7
  DB_USER = root
8
8
  DB_PASSWORD = password
9
- DB_DATABASE = test
9
+ DB_DATABASE = prod
10
10
 
11
11
  # TOKEN
12
12
  SECRET_KEY = secretKey
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "graphql",
2
+ "name": "typescript-express-starter",
3
3
  "version": "0.0.0",
4
- "description": "TypeScript + GraphQL + TypeORM + Express API Server",
4
+ "description": "TypeScript + GraphQL + TypeORM + PostgreSQL + Express API Server",
5
5
  "author": "",
6
6
  "license": "ISC",
7
7
  "scripts": {
@@ -44,15 +44,12 @@
44
44
  "@types/compression": "^1.7.1",
45
45
  "@types/cookie-parser": "^1.4.2",
46
46
  "@types/cors": "^2.8.11",
47
- "@types/dotenv": "^8.2.0",
48
47
  "@types/express": "^4.17.13",
49
- "@types/helmet": "^4.0.0",
50
48
  "@types/hpp": "^0.2.1",
51
- "@types/jest": "^26.0.24",
49
+ "@types/jest": "27.4.x",
52
50
  "@types/jsonwebtoken": "^8.5.4",
53
51
  "@types/node": "^16.0.1",
54
52
  "@types/supertest": "^2.0.11",
55
- "@types/winston": "^2.4.4",
56
53
  "@typescript-eslint/eslint-plugin": "^4.28.2",
57
54
  "@typescript-eslint/parser": "^4.28.2",
58
55
  "cross-env": "^7.0.3",
@@ -60,15 +57,15 @@
60
57
  "eslint-config-prettier": "^8.3.0",
61
58
  "eslint-plugin-prettier": "^3.4.0",
62
59
  "husky": "^7.0.1",
63
- "jest": "^27.0.6",
60
+ "jest": "27.4.x",
64
61
  "lint-staged": "^11.0.0",
65
62
  "node-config": "^0.0.2",
66
63
  "node-gyp": "^8.1.0",
67
64
  "nodemon": "^2.0.9",
68
65
  "pm2": "^5.1.0",
69
66
  "prettier": "^2.3.2",
70
- "supertest": "^6.1.3",
71
- "ts-jest": "^27.0.7",
67
+ "supertest": "^6.2.2",
68
+ "ts-jest": "^27.1.4",
72
69
  "ts-node": "^10.4.0",
73
70
  "tsc-alias": "^1.4.1",
74
71
  "tsconfig-paths": "^3.10.1",
@@ -6,7 +6,7 @@ DB_HOST = localhost
6
6
  DB_PORT = 3306
7
7
  DB_USER = root
8
8
  DB_PASSWORD = password
9
- DB_DATABASE = test
9
+ DB_DATABASE = dev
10
10
 
11
11
  # TOKEN
12
12
  SECRET_KEY = secretKey
@@ -6,7 +6,7 @@ DB_HOST = localhost
6
6
  DB_PORT = 3306
7
7
  DB_USER = root
8
8
  DB_PASSWORD = password
9
- DB_DATABASE = test
9
+ DB_DATABASE = prod
10
10
 
11
11
  # TOKEN
12
12
  SECRET_KEY = secretKey
@@ -22,12 +22,12 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "bcrypt": "^5.0.1",
25
- "class-transformer": "^0.4.0",
25
+ "class-transformer": "^0.5.1",
26
26
  "class-validator": "^0.13.1",
27
27
  "compression": "^1.7.4",
28
28
  "cookie-parser": "^1.4.5",
29
29
  "cors": "^2.8.5",
30
- "dotenv": "^9.0.2",
30
+ "dotenv": "^10.0.0",
31
31
  "envalid": "^7.1.0",
32
32
  "express": "^4.17.1",
33
33
  "helmet": "^4.6.0",
@@ -46,38 +46,35 @@
46
46
  "@swc/cli": "^0.1.51",
47
47
  "@swc/core": "^1.2.108",
48
48
  "@types/bcrypt": "^5.0.0",
49
- "@types/compression": "^1.7.0",
49
+ "@types/compression": "^1.7.1",
50
50
  "@types/cookie-parser": "^1.4.2",
51
- "@types/cors": "^2.8.10",
52
- "@types/dotenv": "^8.2.0",
53
- "@types/express": "^4.17.11",
54
- "@types/helmet": "^4.0.0",
51
+ "@types/cors": "^2.8.11",
52
+ "@types/express": "^4.17.13",
55
53
  "@types/hpp": "^0.2.1",
56
- "@types/jest": "^26.0.23",
57
- "@types/jsonwebtoken": "^8.5.1",
54
+ "@types/jest": "27.4.x",
55
+ "@types/jsonwebtoken": "^8.5.4",
58
56
  "@types/knex": "^0.16.1",
59
- "@types/morgan": "^1.9.2",
60
- "@types/node": "^15.0.2",
57
+ "@types/morgan": "^1.9.3",
58
+ "@types/node": "^16.0.1",
61
59
  "@types/supertest": "^2.0.11",
62
- "@types/swagger-jsdoc": "^6.0.0",
63
- "@types/swagger-ui-express": "^4.1.2",
64
- "@types/winston": "^2.4.4",
65
- "@typescript-eslint/eslint-plugin": "^4.23.0",
66
- "@typescript-eslint/parser": "^4.23.0",
60
+ "@types/swagger-jsdoc": "^6.0.1",
61
+ "@types/swagger-ui-express": "^4.1.3",
62
+ "@typescript-eslint/eslint-plugin": "^4.28.2",
63
+ "@typescript-eslint/parser": "^4.28.2",
67
64
  "cross-env": "^7.0.3",
68
- "eslint": "^7.26.0",
65
+ "eslint": "^7.30.0",
69
66
  "eslint-config-prettier": "^8.3.0",
70
67
  "eslint-plugin-prettier": "^3.4.0",
71
- "husky": "^6.0.0",
72
- "jest": "^27.0.6",
68
+ "husky": "^7.0.1",
69
+ "jest": "27.4.x",
73
70
  "lint-staged": "^11.0.0",
74
71
  "node-config": "0.0.2",
75
- "node-gyp": "^8.0.0",
76
- "nodemon": "^2.0.7",
72
+ "node-gyp": "^8.1.0",
73
+ "nodemon": "^2.0.9",
77
74
  "pm2": "^5.1.0",
78
- "prettier": "^2.3.0",
79
- "supertest": "^6.1.3",
80
- "ts-jest": "^27.0.7",
75
+ "prettier": "^2.3.2",
76
+ "supertest": "^6.2.2",
77
+ "ts-jest": "^27.1.4",
81
78
  "ts-node": "^10.4.0",
82
79
  "tsc-alias": "^1.4.1",
83
80
  "tsconfig-paths": "^3.10.1",
@@ -25,8 +25,3 @@ Content-Type: application/json
25
25
  # User Logout
26
26
  POST {{ baseURL }}/logout
27
27
  Content-Type: application/json
28
-
29
- {
30
- "email": "example@email.com",
31
- "password": "password"
32
- }
@@ -111,9 +111,6 @@ definitions:
111
111
  - email
112
112
  - password
113
113
  properties:
114
- id:
115
- type: integer
116
- description: user Id
117
114
  email:
118
115
  type: string
119
116
  description: user Email
@@ -0,0 +1,18 @@
1
+ # compiled output
2
+ .vscode
3
+ /node_modules
4
+
5
+ # code formatter
6
+ .eslintrc
7
+ .eslintignore
8
+ .editorconfig
9
+ .huskyrc
10
+ .lintstagedrc.json
11
+ .prettierrc
12
+
13
+ # test
14
+ jest.config.js
15
+
16
+ # docker
17
+ Dockerfile
18
+ docker-compose.yml
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 2
6
+ end_of_line = lf
7
+ charset = utf-8
8
+ trim_trailing_whitespace = true
9
+ insert_final_newline = true
@@ -0,0 +1,18 @@
1
+ # PORT
2
+ PORT = 3000
3
+
4
+ # DATABASE
5
+ DB_HOST = localhost
6
+ DB_PORT = 27017
7
+ DB_DATABASE = dev
8
+
9
+ # TOKEN
10
+ SECRET_KEY = secretKey
11
+
12
+ # LOG
13
+ LOG_FORMAT = dev
14
+ LOG_DIR = ../logs
15
+
16
+ # CORS
17
+ ORIGIN = *
18
+ CREDENTIALS = true
@@ -0,0 +1,18 @@
1
+ # PORT
2
+ PORT = 3000
3
+
4
+ # DATABASE
5
+ DB_HOST = localhost
6
+ DB_PORT = 27017
7
+ DB_DATABASE = prod
8
+
9
+ # TOKEN
10
+ SECRET_KEY = secretKey
11
+
12
+ # LOG
13
+ LOG_FORMAT = combined
14
+ LOG_DIR = ../logs
15
+
16
+ # CORS
17
+ ORIGIN = your.domain.com
18
+ CREDENTIALS = true
@@ -0,0 +1,18 @@
1
+ # PORT
2
+ PORT = 3000
3
+
4
+ # DATABASE
5
+ DB_HOST = localhost
6
+ DB_PORT = 27017
7
+ DB_DATABASE = test
8
+
9
+ # TOKEN
10
+ SECRET_KEY = secretKey
11
+
12
+ # LOG
13
+ LOG_FORMAT = dev
14
+ LOG_DIR = ../logs
15
+
16
+ # CORS
17
+ ORIGIN = *
18
+ CREDENTIALS = true
@@ -0,0 +1 @@
1
+ /dist
@@ -0,0 +1,18 @@
1
+ {
2
+ "parser": "@typescript-eslint/parser",
3
+ "extends": ["prettier", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"],
4
+ "parserOptions": {
5
+ "ecmaVersion": 2018,
6
+ "sourceType": "module"
7
+ },
8
+ "rules": {
9
+ "@typescript-eslint/explicit-member-accessibility": 0,
10
+ "@typescript-eslint/explicit-function-return-type": 0,
11
+ "@typescript-eslint/no-parameter-properties": 0,
12
+ "@typescript-eslint/interface-name-prefix": 0,
13
+ "@typescript-eslint/explicit-module-boundary-types": 0,
14
+ "@typescript-eslint/no-explicit-any": "off",
15
+ "@typescript-eslint/ban-types": "off",
16
+ "@typescript-eslint/no-var-requires": "off"
17
+ }
18
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "hooks": {
3
+ "pre-commit": "lint-staged"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "*.ts": [
3
+ "npm run lint"
4
+ ]
5
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "printWidth": 150,
3
+ "tabWidth": 2,
4
+ "singleQuote": true,
5
+ "trailingComma": "all",
6
+ "semi": true,
7
+ "arrowParens": "avoid"
8
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "jsc": {
3
+ "parser": {
4
+ "syntax": "typescript",
5
+ "tsx": false,
6
+ "dynamicImport": true,
7
+ "decorators": true
8
+ },
9
+ "transform": {
10
+ "legacyDecorator": true,
11
+ "decoratorMetadata": true
12
+ },
13
+ "target": "es2017",
14
+ "externalHelpers": false,
15
+ "keepClassNames": true,
16
+ "loose": false,
17
+ "minify": {
18
+ "compress": false,
19
+ "mangle": false
20
+ },
21
+ "baseUrl": "src",
22
+ "paths": {
23
+ "@/*": ["*"],
24
+ "@config": ["config"],
25
+ "@controllers/*": ["controllers/*"],
26
+ "@databases": ["databases"],
27
+ "@dtos/*": ["dtos/*"],
28
+ "@entities/*": ["entities/*"],
29
+ "@exceptions/*": ["exceptions/*"],
30
+ "@interfaces/*": ["interfaces/*"],
31
+ "@middlewares/*": ["middlewares/*"],
32
+ "@models/*": ["models/*"],
33
+ "@routes/*": ["routes/*"],
34
+ "@services/*": ["services/*"],
35
+ "@utils/*": ["utils/*"]
36
+ }
37
+ },
38
+ "module": {
39
+ "type": "commonjs"
40
+ }
41
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+ {
5
+ "type": "node-terminal",
6
+ "request": "launch",
7
+ "name": "Dev typescript-express-starter",
8
+ "command": "npm run dev"
9
+ },
10
+ {
11
+ "type": "node-terminal",
12
+ "request": "launch",
13
+ "name": "Start typescript-express-starter",
14
+ "command": "npm run start"
15
+ },
16
+ {
17
+ "type": "node-terminal",
18
+ "request": "launch",
19
+ "name": "Test typescript-express-starter",
20
+ "command": "npm run test"
21
+ },
22
+ {
23
+ "type": "node-terminal",
24
+ "request": "launch",
25
+ "name": "Lint typescript-express-starter",
26
+ "command": "npm run lint"
27
+ },
28
+ {
29
+ "type": "node-terminal",
30
+ "request": "launch",
31
+ "name": "Lint:Fix typescript-express-starter",
32
+ "command": "npm run lint:fix"
33
+ }
34
+ ]
35
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "editor.codeActionsOnSave": {
3
+ "source.fixAll.eslint": true
4
+ },
5
+ "editor.formatOnSave": false
6
+ }
@@ -0,0 +1,24 @@
1
+ # Common build stage
2
+ FROM node:14.14.0-alpine3.12 as common-build-stage
3
+
4
+ COPY . ./app
5
+
6
+ WORKDIR /app
7
+
8
+ RUN npm install
9
+
10
+ EXPOSE 3000
11
+
12
+ # Development build stage
13
+ FROM common-build-stage as development-build-stage
14
+
15
+ ENV NODE_ENV development
16
+
17
+ CMD ["npm", "run", "dev"]
18
+
19
+ # Production build stage
20
+ FROM common-build-stage as production-build-stage
21
+
22
+ ENV NODE_ENV production
23
+
24
+ CMD ["npm", "run", "start"]
@@ -0,0 +1,29 @@
1
+ # app name should be overridden.
2
+ # ex) production-stage: make build APP_NAME=<APP_NAME>
3
+ # ex) development-stage: make build-dev APP_NAME=<APP_NAME>
4
+
5
+ APP_NAME = typescript-express
6
+ APP_NAME := $(APP_NAME)
7
+
8
+ .PHONY: build
9
+ # Build the container image - Dvelopment
10
+ build-dev:
11
+ docker build -t ${APP_NAME}\
12
+ --target development-build-stage\
13
+ -f Dockerfile .
14
+
15
+ # Build the container image - Production
16
+ build:
17
+ docker build -t ${APP_NAME}\
18
+ --target production-build-stage\
19
+ -f Dockerfile .
20
+
21
+ # Clean the container image
22
+ clean:
23
+ docker rmi -f ${APP_NAME}
24
+
25
+ # Run the container image
26
+ run:
27
+ docker run -d -it -p 3000:3000 ${APP_NAME}
28
+
29
+ all: build
@@ -0,0 +1,46 @@
1
+ version: '3.7'
2
+
3
+ services:
4
+ proxy:
5
+ image: nginx:alpine
6
+ container_name: proxy
7
+ ports:
8
+ - '80:80'
9
+ volumes:
10
+ - ./nginx.conf:/etc/nginx/nginx.conf
11
+ restart: 'unless-stopped'
12
+ networks:
13
+ - backend
14
+ server:
15
+ build:
16
+ context: ./
17
+ target: development-build-stage
18
+ dockerfile: Dockerfile
19
+ container_name: server
20
+ ports:
21
+ - '3000:3000'
22
+ volumes:
23
+ - ./:/app
24
+ - /app/node_modules
25
+ restart: 'unless-stopped'
26
+ networks:
27
+ - backend
28
+ links:
29
+ - mongo
30
+ depends_on:
31
+ - mongo
32
+ mongo:
33
+ image: mvertes/alpine-mongo
34
+ container_name: mongo
35
+ ports:
36
+ - '27017:27017'
37
+ networks:
38
+ - backend
39
+
40
+ networks:
41
+ backend:
42
+ driver: bridge
43
+
44
+ volumes:
45
+ data:
46
+ driver: local