typescript-express-starter 6.2.0 → 8.0.0
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.
- package/README.kr.md +55 -26
- package/README.md +54 -25
- package/bin/cli.js +4 -3
- package/lib/default/.swcrc +41 -0
- package/lib/default/nodemon.json +2 -2
- package/lib/default/package.json +12 -8
- package/lib/default/src/app.ts +1 -2
- package/lib/default/src/http/auth.http +12 -15
- package/lib/default/src/http/users.http +12 -16
- package/lib/default/src/index.ts +1 -0
- package/lib/default/src/middlewares/auth.middleware.ts +3 -3
- package/lib/default/src/models/users.model.ts +5 -5
- package/lib/default/src/server.ts +1 -2
- package/lib/default/src/services/auth.service.ts +5 -5
- package/lib/default/src/services/users.service.ts +3 -3
- package/lib/default/src/tests/auth.test.ts +4 -4
- package/lib/default/src/tests/users.test.ts +4 -4
- package/lib/default/src/utils/logger.ts +5 -5
- package/lib/default/tsconfig.json +2 -2
- package/lib/graphql/.dockerignore +18 -0
- package/lib/graphql/.editorconfig +9 -0
- package/lib/graphql/.env +1 -0
- package/lib/graphql/.eslintignore +1 -0
- package/lib/graphql/.eslintrc +18 -0
- package/lib/graphql/.huskyrc +5 -0
- package/lib/graphql/.lintstagedrc.json +5 -0
- package/lib/graphql/.prettierrc +8 -0
- package/lib/graphql/.swcrc +39 -0
- package/lib/graphql/.vscode/launch.json +35 -0
- package/lib/graphql/.vscode/settings.json +6 -0
- package/lib/graphql/Dockerfile +24 -0
- package/lib/graphql/Makefile +6 -0
- package/lib/graphql/docker-compose.yml +50 -0
- package/lib/graphql/ecosystem.config.js +59 -0
- package/lib/graphql/jest.config.js +12 -0
- package/lib/graphql/nginx.conf +40 -0
- package/lib/graphql/nodemon.json +12 -0
- package/lib/graphql/package.json +79 -0
- package/lib/graphql/src/app.ts +105 -0
- package/lib/graphql/src/configs/development.json +19 -0
- package/lib/graphql/src/configs/production.json +19 -0
- package/lib/graphql/src/configs/test.json +19 -0
- package/lib/graphql/src/databases/index.ts +24 -0
- package/lib/graphql/src/dtos/users.dto.ts +14 -0
- package/lib/{typeorm/src/entity → graphql/src/entities}/users.entity.ts +3 -3
- package/lib/graphql/src/exceptions/HttpException.ts +10 -0
- package/lib/graphql/src/http/auth.http +49 -0
- package/lib/graphql/src/http/users.http +78 -0
- package/lib/graphql/src/index.ts +1 -0
- package/lib/graphql/src/interfaces/auth.interface.ts +14 -0
- package/lib/graphql/src/interfaces/db.interface.ts +7 -0
- package/lib/graphql/src/interfaces/users.interface.ts +5 -0
- package/lib/graphql/src/middlewares/auth.middleware.ts +32 -0
- package/lib/graphql/src/middlewares/error.middleware.ts +17 -0
- package/lib/graphql/src/repositories/auth.repository.ts +61 -0
- package/lib/graphql/src/repositories/users.repository.ts +60 -0
- package/lib/graphql/src/resolvers/auth.resolver.ts +32 -0
- package/lib/graphql/src/resolvers/users.resolver.ts +47 -0
- package/lib/graphql/src/server.ts +14 -0
- package/lib/graphql/src/tests/auth.test.ts +52 -0
- package/lib/graphql/src/tests/index.test.ts +18 -0
- package/lib/graphql/src/tests/users.test.ts +71 -0
- package/lib/graphql/src/typedefs/users.type.ts +13 -0
- package/lib/graphql/src/utils/logger.ts +75 -0
- package/lib/graphql/src/utils/util.ts +19 -0
- package/lib/graphql/src/utils/validateEnv.ts +10 -0
- package/lib/graphql/tsconfig.json +39 -0
- package/lib/knex/.swcrc +39 -0
- package/lib/knex/knexfile.ts +6 -6
- package/lib/knex/nodemon.json +2 -2
- package/lib/knex/package.json +11 -8
- package/lib/knex/src/app.ts +2 -3
- package/lib/knex/src/databases/index.ts +6 -6
- package/lib/knex/src/http/auth.http +12 -15
- package/lib/knex/src/http/users.http +12 -16
- package/lib/knex/src/index.ts +1 -0
- package/lib/knex/src/middlewares/auth.middleware.ts +4 -4
- package/lib/knex/src/server.ts +1 -2
- package/lib/knex/src/services/auth.service.ts +5 -5
- package/lib/knex/src/services/users.service.ts +3 -3
- package/lib/knex/src/tests/auth.test.ts +2 -2
- package/lib/knex/src/tests/index.test.ts +1 -1
- package/lib/knex/src/tests/users.test.ts +2 -2
- package/lib/knex/src/utils/logger.ts +5 -5
- package/lib/knex/tsconfig.json +2 -2
- package/lib/mongoose/.swcrc +39 -0
- package/lib/mongoose/docker-compose.yml +0 -4
- package/lib/mongoose/nodemon.json +2 -2
- package/lib/mongoose/package.json +12 -8
- package/lib/mongoose/src/app.ts +2 -3
- package/lib/mongoose/src/configs/development.json +1 -1
- package/lib/mongoose/src/configs/production.json +1 -1
- package/lib/mongoose/src/configs/test.json +1 -1
- package/lib/mongoose/src/http/auth.http +32 -0
- package/lib/mongoose/src/http/users.http +34 -0
- package/lib/mongoose/src/index.ts +1 -0
- package/lib/mongoose/src/middlewares/auth.middleware.ts +3 -3
- package/lib/mongoose/src/server.ts +1 -2
- package/lib/mongoose/src/services/auth.service.ts +5 -5
- package/lib/mongoose/src/services/users.service.ts +3 -3
- package/lib/mongoose/src/utils/logger.ts +5 -5
- package/lib/mongoose/tsconfig.json +2 -2
- package/lib/prisma/.env +1 -1
- package/lib/prisma/.swcrc +37 -0
- package/lib/prisma/docker-compose.yml +1 -6
- package/lib/prisma/nodemon.json +2 -2
- package/lib/prisma/package.json +14 -10
- package/lib/prisma/src/app.ts +2 -3
- package/lib/prisma/src/http/auth.http +12 -15
- package/lib/prisma/src/http/users.http +12 -16
- package/lib/prisma/src/index.ts +1 -0
- package/lib/prisma/src/middlewares/auth.middleware.ts +4 -4
- package/lib/prisma/src/server.ts +1 -2
- package/lib/prisma/src/services/auth.service.ts +5 -5
- package/lib/prisma/src/services/users.service.ts +3 -3
- package/lib/prisma/src/utils/logger.ts +5 -5
- package/lib/prisma/tsconfig.json +2 -2
- package/lib/routing-controllers/.swcrc +37 -0
- package/lib/routing-controllers/nodemon.json +2 -2
- package/lib/routing-controllers/package.json +12 -9
- package/lib/routing-controllers/src/app.ts +3 -4
- package/lib/routing-controllers/src/http/auth.http +12 -15
- package/lib/routing-controllers/src/http/users.http +12 -16
- package/lib/routing-controllers/src/index.ts +1 -0
- package/lib/routing-controllers/src/middlewares/auth.middleware.ts +3 -3
- package/lib/routing-controllers/src/middlewares/validation.middleware.ts +10 -2
- package/lib/routing-controllers/src/models/users.model.ts +5 -5
- package/lib/routing-controllers/src/server.ts +1 -3
- package/lib/routing-controllers/src/services/auth.service.ts +5 -5
- package/lib/routing-controllers/src/services/users.service.ts +3 -3
- package/lib/routing-controllers/src/utils/logger.ts +5 -5
- package/lib/routing-controllers/tsconfig.json +2 -2
- package/lib/sequelize/.swcrc +39 -0
- package/lib/sequelize/docker-compose.yml +1 -6
- package/lib/sequelize/nodemon.json +2 -2
- package/lib/sequelize/package.json +12 -8
- package/lib/sequelize/src/app.ts +1 -2
- package/lib/sequelize/src/configs/development.json +2 -2
- package/lib/sequelize/src/configs/production.json +1 -1
- package/lib/sequelize/src/configs/test.json +1 -1
- package/lib/sequelize/src/http/auth.http +32 -0
- package/lib/sequelize/src/http/users.http +34 -0
- package/lib/sequelize/src/index.ts +1 -0
- package/lib/sequelize/src/middlewares/auth.middleware.ts +4 -4
- package/lib/sequelize/src/server.ts +1 -2
- package/lib/sequelize/src/services/auth.service.ts +5 -5
- package/lib/sequelize/src/services/users.service.ts +3 -3
- package/lib/sequelize/src/utils/logger.ts +5 -5
- package/lib/sequelize/tsconfig.json +2 -2
- package/lib/starter.js +5 -9
- package/lib/typegoose/.dockerignore +18 -0
- package/lib/typegoose/.editorconfig +9 -0
- package/lib/typegoose/.env.development.local +18 -0
- package/lib/typegoose/.env.production.local +18 -0
- package/lib/typegoose/.env.test.local +18 -0
- package/lib/typegoose/.eslintignore +1 -0
- package/lib/typegoose/.eslintrc +18 -0
- package/lib/typegoose/.huskyrc +5 -0
- package/lib/typegoose/.lintstagedrc.json +5 -0
- package/lib/typegoose/.prettierrc +8 -0
- package/lib/typegoose/.swcrc +40 -0
- package/lib/typegoose/.vscode/launch.json +35 -0
- package/lib/typegoose/.vscode/settings.json +6 -0
- package/lib/typegoose/Dockerfile +24 -0
- package/lib/typegoose/Makefile +6 -0
- package/lib/typegoose/docker-compose.yml +46 -0
- package/lib/typegoose/ecosystem.config.js +57 -0
- package/lib/typegoose/jest.config.js +12 -0
- package/lib/typegoose/nginx.conf +40 -0
- package/lib/typegoose/nodemon.json +12 -0
- package/lib/typegoose/package.json +80 -0
- package/lib/typegoose/src/app.ts +93 -0
- package/lib/typegoose/src/config/index.ts +5 -0
- package/lib/typegoose/src/controllers/auth.controller.ts +46 -0
- package/lib/typegoose/src/controllers/index.controller.ts +13 -0
- package/lib/typegoose/src/controllers/users.controller.ts +65 -0
- package/lib/typegoose/src/databases/index.ts +3 -0
- package/lib/typegoose/src/dtos/users.dto.ts +9 -0
- package/lib/typegoose/src/exceptions/HttpException.ts +10 -0
- package/lib/typegoose/src/http/auth.http +32 -0
- package/lib/typegoose/src/http/users.http +34 -0
- package/lib/typegoose/src/interfaces/auth.interface.ts +15 -0
- package/lib/typegoose/src/interfaces/routes.interface.ts +6 -0
- package/lib/typegoose/src/interfaces/users.interface.ts +5 -0
- package/lib/typegoose/src/middlewares/auth.middleware.ts +32 -0
- package/lib/typegoose/src/middlewares/error.middleware.ts +17 -0
- package/lib/typegoose/src/middlewares/validation.middleware.ts +25 -0
- package/lib/typegoose/src/models/users.model.ts +18 -0
- package/lib/typegoose/src/routes/auth.route.ts +24 -0
- package/lib/typegoose/src/routes/index.route.ts +19 -0
- package/lib/typegoose/src/routes/users.route.ts +25 -0
- package/lib/typegoose/src/server.ts +11 -0
- package/lib/typegoose/src/services/auth.service.ts +61 -0
- package/lib/typegoose/src/services/users.service.ts +64 -0
- package/lib/typegoose/src/tests/auth.test.ts +83 -0
- package/lib/typegoose/src/tests/index.test.ts +18 -0
- package/lib/typegoose/src/tests/users.test.ts +133 -0
- package/lib/typegoose/src/utils/logger.ts +65 -0
- package/lib/typegoose/src/utils/util.ts +19 -0
- package/lib/typegoose/src/utils/validateEnv.ts +10 -0
- package/lib/typegoose/swagger.yaml +122 -0
- package/lib/typegoose/tsconfig.json +40 -0
- package/lib/typeorm/.swcrc +39 -0
- package/lib/typeorm/docker-compose.yml +1 -1
- package/lib/typeorm/nodemon.json +2 -2
- package/lib/typeorm/package.json +12 -8
- package/lib/typeorm/src/app.ts +1 -2
- package/lib/typeorm/src/configs/development.json +1 -1
- package/lib/typeorm/src/configs/production.json +1 -1
- package/lib/typeorm/src/configs/test.json +1 -1
- package/lib/typeorm/src/databases/index.ts +5 -5
- package/lib/typeorm/src/entities/users.entity.ts +26 -0
- package/lib/typeorm/src/http/auth.http +12 -15
- package/lib/typeorm/src/http/users.http +12 -16
- package/lib/typeorm/src/index.ts +1 -0
- package/lib/typeorm/src/middlewares/auth.middleware.ts +5 -9
- package/lib/typeorm/src/server.ts +1 -2
- package/lib/typeorm/src/services/auth.service.ts +13 -17
- package/lib/typeorm/src/services/users.service.ts +16 -22
- package/lib/typeorm/src/utils/logger.ts +5 -5
- package/lib/typeorm/tsconfig.json +3 -3
- package/package.json +14 -4
package/README.kr.md
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
- [🇺🇸 영어](https://github.com/ljlm0402/typescript-express-starter/blob/master/README.md)
|
|
47
47
|
- [🇰🇷 한국어](https://github.com/ljlm0402/typescript-express-starter/blob/master/README.kr.md)
|
|
48
48
|
|
|
49
|
-
> 번역을 도와주실 분은 이슈 남겨주시기 바랍니다. 💜
|
|
49
|
+
> 번역을 도와주실 분은 [이슈](https://github.com/ljlm0402/typescript-express-starter/issues/new?assignees=ljlm0402&labels=%F0%9F%92%B1+Translations&template=translations-language---.md&title=) 남겨주시기 바랍니다. 💜
|
|
50
50
|
|
|
51
51
|
<br />
|
|
52
52
|
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
|
|
55
55
|
- [💁🏻♂️ Dylan Iqbal :: A TypeScript Express Starter App](https://bit.ly/3rrZFZ9)
|
|
56
56
|
|
|
57
|
-
> 웹 사이트 및 블로그에 소개를 원하시는 분은 이슈 남겨주시기 바랍니다. 💙
|
|
57
|
+
> 웹 사이트 및 블로그에 소개를 원하시는 분은 [이슈](https://github.com/ljlm0402/typescript-express-starter/issues/new?assignees=ljlm0402&labels=%F0%9F%91%80+Introducetion&template=introducetion-project---.md&title=) 남겨주시기 바랍니다. 💙
|
|
58
58
|
|
|
59
59
|
<br />
|
|
60
60
|
|
|
@@ -100,18 +100,19 @@ $ npx typescript-express-starter "project name"
|
|
|
100
100
|
| :------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
101
101
|
| Default | Express 기본 |
|
|
102
102
|
| Routing Controllers | 데코레이터 사용량이 많은 구조화되고 선언적이며 아름답게 구성된 클래스 기반 컨트롤러 생성 |
|
|
103
|
-
|
|
|
103
|
+
| Sequelize | PostgreSQL, MySQL, MariaDB, SQLite, Microsoft SQL Server를 지원하는 Promise 패턴 기반의 Node.js ORM |
|
|
104
104
|
| Mongoose | Node.js와 MongoDB를 위한 ODM(Object Data Mapping) 라이브러리 |
|
|
105
105
|
| TypeORM | 자바스크립트, 타입스크립트과 함께 사용되어 Node.js, React Native, Expo에서 실행될 수 있는 ORM |
|
|
106
106
|
| Prisma | 데이터베이스에 데이터를 프로그래밍 언어의 객체와 매핑하여 기존에 SQL로 작성하던 데이터를 수정, 테이블 구조 변경등의 작업을 객체를 통해 프로그래밍적으로 할 수 있도록 해주는 ORM |
|
|
107
107
|
| Knex | 쿼리 빌더를 위한 라이브러리 |
|
|
108
|
-
| GraphQL
|
|
108
|
+
| GraphQL | API 용 쿼리 언어이며 기존 데이터로 이러한 쿼리를 수행하기위한 런타임 |
|
|
109
|
+
| Typegoose | 타입스크립트 클래스를 사용하여 몽구스 모델 정의 |
|
|
109
110
|
|
|
110
111
|
## 🛎 Script 명령어
|
|
111
112
|
|
|
112
113
|
- 프로덕션 모드 실행 : `npm run start` 아니면 `Start typescript-express-starter` VS Code 로
|
|
113
114
|
- 개발 모드 실행 : `npm run dev` 아니면 `Dev typescript-express-starter` VS Code 로
|
|
114
|
-
- 단위 테스트 : `npm
|
|
115
|
+
- 단위 테스트 : `npm test` 아니면 `Test typescript-express-starter` VS Code 로
|
|
115
116
|
- 코드 포맷터 검사 : `npm run lint` 아니면 `Lint typescript-express-starter` VS Code 로
|
|
116
117
|
- 코드 포맷터 적용 : `npm run lint:fix` 아니면 `Lint:Fix typescript-express-starter` VS Code 로
|
|
117
118
|
|
|
@@ -132,6 +133,7 @@ $ npx typescript-express-starter "project name"
|
|
|
132
133
|

|
|
133
134
|

|
|
134
135
|

|
|
136
|
+

|
|
135
137
|
|
|
136
138
|
- Utilities
|
|
137
139
|
|
|
@@ -145,24 +147,24 @@ $ npx typescript-express-starter "project name"
|
|
|
145
147
|
|
|
146
148
|
> [Simple Icons](https://simpleicons.org/)
|
|
147
149
|
|
|
148
|
-
### 🐳
|
|
150
|
+
### 🐳 Docker :: 컨테이너 플랫폼
|
|
149
151
|
|
|
150
|
-
[
|
|
152
|
+
[Docker](https://docs.docker.com/)란, 컨테이너 기반의 오픈소스 가상화 플랫폼이다.
|
|
151
153
|
|
|
152
|
-
[
|
|
154
|
+
[설치 홈페이지](https://docs.docker.com/get-docker/)에 접속해서 설치를 해줍니다.
|
|
153
155
|
|
|
154
156
|
- 백그라운드에서 컨테이너를 시작하고 실행 : `docker-compose up -d`
|
|
155
157
|
- 컨테이너를 중지하고 컨테이너, 네트워크, 볼륨 및 이미지를 제거 : `docker-compose down`
|
|
156
158
|
|
|
157
159
|
수정을 원하시면 `docker-compose.yml`과 `Dockerfile`를 수정해주시면 됩니다.
|
|
158
160
|
|
|
159
|
-
### ♻️
|
|
161
|
+
### ♻️ Nginx :: 웹 서버
|
|
160
162
|
|
|
161
|
-
[
|
|
163
|
+
[Nginx](https://www.nginx.com/) 역방향 프록시,로드 밸런서, 메일 프록시 및 HTTP 캐시로도 사용할 수있는 웹 서버입니다.
|
|
162
164
|
|
|
163
165
|
프록시는 일반적으로 여러 서버에로드를 분산하거나, 다른 웹 사이트의 콘텐츠를 원활하게 표시하거나, HTTP 이외의 프로토콜을 통해 처리 요청을 애플리케이션 서버에 전달하는 데 사용됩니다.
|
|
164
166
|
|
|
165
|
-
|
|
167
|
+
Nginx 요청을 프록시하면 지정된 프록시 서버로 요청을 보내고 응답을 가져 와서 클라이언트로 다시 보냅니다.
|
|
166
168
|
|
|
167
169
|
수정을 원하시면 `nginx.conf` 파일을 수정해주시면 됩니다.
|
|
168
170
|
|
|
@@ -188,13 +190,13 @@ $ npx typescript-express-starter "project name"
|
|
|
188
190
|
|
|
189
191
|
> 2019년, TSLint 지원이 종료 되어 ESLint를 적용하였습니다.
|
|
190
192
|
|
|
191
|
-
### 📗
|
|
193
|
+
### 📗 Swagger :: API 문서화
|
|
192
194
|
|
|
193
|
-
[
|
|
195
|
+
[Swagger](https://swagger.io/)는 개발자가 REST 웹 서비스를 설계, 빌드, 문서화, 소비하는 일을 도와주는 대형 도구 생태계의 지원을 받는 오픈 소스 소프트웨어 프레임워크이다.
|
|
194
196
|
|
|
195
197
|
API를 대규모로 설계하고 문서화하는 데 용이하게 사용합니다.
|
|
196
198
|
|
|
197
|
-
|
|
199
|
+
Swagger URL은 `http://localhost:3000/api-docs` 으로 작성했습니다.
|
|
198
200
|
|
|
199
201
|
수정을 원하시면 `swagger.yaml` 파일을 수정해주시면 됩니다.
|
|
200
202
|
|
|
@@ -215,6 +217,17 @@ VSCode Extension에서 [REST Client](https://marketplace.visualstudio.com/items?
|
|
|
215
217
|
|
|
216
218
|
수정을 원하시면 `ecosystem.config.js` 파일을 수정해주시면 됩니다.
|
|
217
219
|
|
|
220
|
+
### 🏎 SWC :: 강하고 빠른 자바스크립트 / 타입스크립트 컴파일러
|
|
221
|
+
|
|
222
|
+
[SWC](https://swc.rs/)는 차세대 고속 개발자 도구를 위한 확장 가능한 Rust 기반 플랫폼입니다.
|
|
223
|
+
|
|
224
|
+
`SWC는 단일 스레드에서 Babel보다 20배, 4개 코어에서 70배 빠릅니다.`
|
|
225
|
+
|
|
226
|
+
- swc 빌드 :: `npm run build`
|
|
227
|
+
- tsc 빌드 :: `npm run build:tsc`
|
|
228
|
+
|
|
229
|
+
수정을 원하시면 `.swcrc` 파일을 수정해주시면 됩니다.
|
|
230
|
+
|
|
218
231
|
## 🗂 코드 구조 (default)
|
|
219
232
|
|
|
220
233
|
```bash
|
|
@@ -277,6 +290,7 @@ VSCode Extension에서 [REST Client](https://marketplace.visualstudio.com/items?
|
|
|
277
290
|
│ │ └── vaildateEnv.ts
|
|
278
291
|
│ │
|
|
279
292
|
│ ├── app.ts
|
|
293
|
+
│ ├── index.ts
|
|
280
294
|
│ └── server.ts
|
|
281
295
|
│
|
|
282
296
|
├── .dockerignore
|
|
@@ -288,6 +302,7 @@ VSCode Extension에서 [REST Client](https://marketplace.visualstudio.com/items?
|
|
|
288
302
|
├── .huskyrc
|
|
289
303
|
├── .lintstagedrc.json
|
|
290
304
|
├── .prettierrc
|
|
305
|
+
├── .swcrc
|
|
291
306
|
├── docker-compose.yml
|
|
292
307
|
├── Dockerfile
|
|
293
308
|
├── ecosystem.config.js
|
|
@@ -301,21 +316,13 @@ VSCode Extension에서 [REST Client](https://marketplace.visualstudio.com/items?
|
|
|
301
316
|
└── tsconfig.json
|
|
302
317
|
```
|
|
303
318
|
|
|
304
|
-
##
|
|
319
|
+
## ⭐️ 주신분들
|
|
305
320
|
|
|
306
|
-
|
|
307
|
-
| :----------------- | :-------------------- |
|
|
308
|
-
| 기능 추가 | ✨ 기능 추가 |
|
|
309
|
-
| 버그 수정 | 🐞 버그 수정 |
|
|
310
|
-
| 코드 개선 | 🛠 코드 개선 |
|
|
311
|
-
| 패키지 설치 | 📦 패키지 설치 |
|
|
312
|
-
| 문서 수정 | 📚 문서 수정 |
|
|
313
|
-
| 버전 업데이트 | 🌼 버전 업데이트 |
|
|
314
|
-
| 새로운 템플릿 추가 | 🎉 새로운 템플릿 추가 |
|
|
321
|
+
[](https://github.com/ljlm0402/typescript-express-starter/stargazers)
|
|
315
322
|
|
|
316
|
-
##
|
|
323
|
+
## 🍴 해주신분들
|
|
317
324
|
|
|
318
|
-
[
|
|
325
|
+
[](https://github.com/ljlm0402/typescript-express-starter/network/members)
|
|
319
326
|
|
|
320
327
|
## 🤝 도움을 주신분들
|
|
321
328
|
|
|
@@ -357,6 +364,28 @@ VSCode Extension에서 [REST Client](https://marketplace.visualstudio.com/items?
|
|
|
357
364
|
|
|
358
365
|
- Amrik Singh [https://github.com/AmrikSD](https://github.com/AmrikSD)
|
|
359
366
|
|
|
367
|
+
- oricc [https://github.com/oricc](https://github.com/oricc)
|
|
368
|
+
|
|
369
|
+
- Dustin Newbold [https://github.com/dustinnewbold](https://github.com/dustinnewbold)
|
|
370
|
+
|
|
371
|
+
- WhatIfWeDigDeeper [https://github.com/WhatIfWeDigDeeper](https://github.com/WhatIfWeDigDeeper)
|
|
372
|
+
|
|
373
|
+
## 💳 라이센스
|
|
374
|
+
|
|
375
|
+
[MIT](LICENSE)
|
|
376
|
+
|
|
377
|
+
## 📬 커밋 메시지 정의
|
|
378
|
+
|
|
379
|
+
| 언제 | 메시지 |
|
|
380
|
+
| :----------------- | :-------------------- |
|
|
381
|
+
| 기능 추가 | ✨ 기능 추가 |
|
|
382
|
+
| 버그 수정 | 🐞 버그 수정 |
|
|
383
|
+
| 코드 개선 | 🛠 코드 개선 |
|
|
384
|
+
| 패키지 설치 | 📦 패키지 설치 |
|
|
385
|
+
| 문서 수정 | 📚 문서 수정 |
|
|
386
|
+
| 버전 업데이트 | 🌼 버전 업데이트 |
|
|
387
|
+
| 새로운 템플릿 추가 | 🎉 새로운 템플릿 추가 |
|
|
388
|
+
|
|
360
389
|
## 📬 이슈를 남겨주세요
|
|
361
390
|
|
|
362
391
|
추후 추가하고자하는 템플릿, 질문, 기능을 적어 주시면 최선을 다해 답변하고 반영하겠습니다.
|
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
- [🇺🇸 English](https://github.com/ljlm0402/typescript-express-starter/blob/master/README.md)
|
|
47
47
|
- [🇰🇷 Korean](https://github.com/ljlm0402/typescript-express-starter/blob/master/README.kr.md)
|
|
48
48
|
|
|
49
|
-
> Want to translate to your own language? please open an issue 💜
|
|
49
|
+
> Want to translate to your own language? please open an [issue](https://github.com/ljlm0402/typescript-express-starter/issues/new?assignees=ljlm0402&labels=%F0%9F%92%B1+Translations&template=translations-language---.md&title=) 💜
|
|
50
50
|
|
|
51
51
|
<br />
|
|
52
52
|
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
|
|
55
55
|
- [💁🏻♂️ Dylan Iqbal :: A TypeScript Express Starter App](https://bit.ly/3rrZFZ9)
|
|
56
56
|
|
|
57
|
-
> Want to be featured on your blog or site? please open an issue 💙
|
|
57
|
+
> Want to be featured on your blog or site? please open an [issue](https://github.com/ljlm0402/typescript-express-starter/issues/new?assignees=ljlm0402&labels=%F0%9F%91%80+Introducetion&template=introducetion-project---.md&title=) 💙
|
|
58
58
|
|
|
59
59
|
<br />
|
|
60
60
|
|
|
@@ -100,22 +100,23 @@ Start your typescript-express-starter app in development mode at `http://localho
|
|
|
100
100
|
|
|
101
101
|
#### Template Type
|
|
102
102
|
|
|
103
|
-
| Name
|
|
104
|
-
|
|
|
105
|
-
| Default
|
|
106
|
-
| Routing Controllers
|
|
107
|
-
|
|
|
108
|
-
| Mongoose
|
|
109
|
-
| TypeORM
|
|
110
|
-
| Prisma
|
|
111
|
-
| Knex
|
|
112
|
-
| GraphQL
|
|
103
|
+
| Name | Description |
|
|
104
|
+
| :------------------ | :----------------------------------------------------------------------------------------------------------- |
|
|
105
|
+
| Default | Express Default |
|
|
106
|
+
| Routing Controllers | Create structured, declarative and beautifully organized class-based controllers with heavy decorators usage |
|
|
107
|
+
| Sequelize | Easy to use multi SQL dialect ORM for Node.js |
|
|
108
|
+
| Mongoose | MongoDB Object Modeling(ODM) designed to work in an asynchronous environment |
|
|
109
|
+
| TypeORM | An ORM that can run in Node.js and Others |
|
|
110
|
+
| Prisma | Modern Database Access for TypeScript & Node.js |
|
|
111
|
+
| Knex | SQL query builder for Postgres, MySQL, MariaDB, SQLite3 and Oracle |
|
|
112
|
+
| GraphQL | query language for APIs and a runtime for fulfilling those queries with your existing data |
|
|
113
|
+
| Typegoose | Define Mongoose models using TypeScript classes |
|
|
113
114
|
|
|
114
115
|
## 🛎 Available Commands for the Server
|
|
115
116
|
|
|
116
117
|
- Run the Server in production mode : `npm run start` or `Start typescript-express-starter` in VS Code
|
|
117
118
|
- Run the Server in development mode : `npm run dev` or `Dev typescript-express-starter` in VS Code
|
|
118
|
-
- Run all unit-tests : `npm
|
|
119
|
+
- Run all unit-tests : `npm test` or `Test typescript-express-starter` in VS Code
|
|
119
120
|
- Check for linting errors : `npm run lint` or `Lint typescript-express-starter` in VS Code
|
|
120
121
|
- Fix for linting : `npm run lint:fix` or `Lint:Fix typescript-express-starter` in VS Code
|
|
121
122
|
|
|
@@ -136,6 +137,7 @@ Start your typescript-express-starter app in development mode at `http://localho
|
|
|
136
137
|

|
|
137
138
|

|
|
138
139
|

|
|
140
|
+

|
|
139
141
|
|
|
140
142
|
- Utilities
|
|
141
143
|
|
|
@@ -220,6 +222,17 @@ Modify `*.http` file in src/http folder to your source code.
|
|
|
220
222
|
|
|
221
223
|
Modify `ecosystem.config.js` file to your source code.
|
|
222
224
|
|
|
225
|
+
### 🏎 SWC :: a super-fast JavaScript / TypeScript compiler
|
|
226
|
+
|
|
227
|
+
[SWC](https://swc.rs/) is an extensible Rust-based platform for the next generation of fast developer tools.
|
|
228
|
+
|
|
229
|
+
`SWC is 20x faster than Babel on a single thread and 70x faster on four cores.`
|
|
230
|
+
|
|
231
|
+
- swc build :: `npm run build`
|
|
232
|
+
- tsc build :: `npm run build:tsc`
|
|
233
|
+
|
|
234
|
+
Modify `.swcrc` file to your source code.
|
|
235
|
+
|
|
223
236
|
## 🗂 Code Structure (default)
|
|
224
237
|
|
|
225
238
|
```bash
|
|
@@ -282,6 +295,7 @@ Modify `ecosystem.config.js` file to your source code.
|
|
|
282
295
|
│ │ └── vaildateEnv.ts
|
|
283
296
|
│ │
|
|
284
297
|
│ ├── app.ts
|
|
298
|
+
│ ├── index.ts
|
|
285
299
|
│ └── server.ts
|
|
286
300
|
│
|
|
287
301
|
├── .dockerignore
|
|
@@ -293,6 +307,7 @@ Modify `ecosystem.config.js` file to your source code.
|
|
|
293
307
|
├── .huskyrc
|
|
294
308
|
├── .lintstagedrc.json
|
|
295
309
|
├── .prettierrc
|
|
310
|
+
├── .swcrc
|
|
296
311
|
├── docker-compose.yml
|
|
297
312
|
├── Dockerfile
|
|
298
313
|
├── ecosystem.config.js
|
|
@@ -306,21 +321,13 @@ Modify `ecosystem.config.js` file to your source code.
|
|
|
306
321
|
└── tsconfig.json
|
|
307
322
|
```
|
|
308
323
|
|
|
309
|
-
##
|
|
324
|
+
## ⭐️ Stargazers
|
|
310
325
|
|
|
311
|
-
|
|
312
|
-
| :--------------- | :----------------- |
|
|
313
|
-
| Add Feature | ✨ Add Feature |
|
|
314
|
-
| Fix Bug | 🐞 Fix Bug |
|
|
315
|
-
| Refactoring Code | 🛠 Refactoring Code |
|
|
316
|
-
| Install Package | 📦 Install Package |
|
|
317
|
-
| Fix Readme | 📚 Fix Readme |
|
|
318
|
-
| Update Version | 🌼 Update Version |
|
|
319
|
-
| New Template | 🎉 New Template |
|
|
326
|
+
[](https://github.com/ljlm0402/typescript-express-starter/stargazers)
|
|
320
327
|
|
|
321
|
-
##
|
|
328
|
+
## 🍴 Forkers
|
|
322
329
|
|
|
323
|
-
[
|
|
330
|
+
[](https://github.com/ljlm0402/typescript-express-starter/network/members)
|
|
324
331
|
|
|
325
332
|
## 🤝 Contributors
|
|
326
333
|
|
|
@@ -362,6 +369,28 @@ Modify `ecosystem.config.js` file to your source code.
|
|
|
362
369
|
|
|
363
370
|
- Amrik Singh [https://github.com/AmrikSD](https://github.com/AmrikSD)
|
|
364
371
|
|
|
372
|
+
- oricc [https://github.com/oricc](https://github.com/oricc)
|
|
373
|
+
|
|
374
|
+
- Dustin Newbold [https://github.com/dustinnewbold](https://github.com/dustinnewbold)
|
|
375
|
+
|
|
376
|
+
- WhatIfWeDigDeeper [https://github.com/WhatIfWeDigDeeper](https://github.com/WhatIfWeDigDeeper)
|
|
377
|
+
|
|
378
|
+
## 💳 License
|
|
379
|
+
|
|
380
|
+
[MIT](LICENSE)
|
|
381
|
+
|
|
382
|
+
## 📬 Recommended Commit Message
|
|
383
|
+
|
|
384
|
+
| When | Commit Message |
|
|
385
|
+
| :--------------- | :----------------- |
|
|
386
|
+
| Add Feature | ✨ Add Feature |
|
|
387
|
+
| Fix Bug | 🐞 Fix Bug |
|
|
388
|
+
| Refactoring Code | 🛠 Refactoring Code |
|
|
389
|
+
| Install Package | 📦 Install Package |
|
|
390
|
+
| Fix Readme | 📚 Fix Readme |
|
|
391
|
+
| Update Version | 🌼 Update Version |
|
|
392
|
+
| New Template | 🎉 New Template |
|
|
393
|
+
|
|
365
394
|
## 📬 Please request an issue
|
|
366
395
|
|
|
367
396
|
In the future, please write down your desired template, questions, and features to be added, and we will try our best to answer and reflect them.
|
package/bin/cli.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/*****************************************************************
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Typescript Express Starter
|
|
5
|
+
* 2019.12.18 ~ 🎮
|
|
6
|
+
* Made By AGUMON 🦖
|
|
7
|
+
* https://github.com/ljlm0402/typescript-express-starter
|
|
7
8
|
*****************************************************************/
|
|
8
9
|
|
|
9
10
|
const path = require("path");
|
|
@@ -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
|
+
"@controllers/*": ["controllers/*"],
|
|
25
|
+
"@dtos/*": ["dtos/*"],
|
|
26
|
+
"@exceptions/*": ["exceptions/*"],
|
|
27
|
+
"@interfaces/*": ["interfaces/*"],
|
|
28
|
+
"@middlewares/*": ["middlewares/*"],
|
|
29
|
+
"@models/*": ["models/*"],
|
|
30
|
+
"@routes/*": ["routes/*"],
|
|
31
|
+
"@services/*": ["services/*"],
|
|
32
|
+
"@utils/*": ["utils/*"]
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"module": {
|
|
36
|
+
"type": "commonjs"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
package/lib/default/nodemon.json
CHANGED
package/lib/default/package.json
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
"scripts": {
|
|
8
8
|
"start": "npm run build && cross-env NODE_ENV=production node dist/server.js",
|
|
9
9
|
"dev": "cross-env NODE_ENV=development nodemon",
|
|
10
|
-
"build": "
|
|
10
|
+
"build": "swc src -d dist --source-maps --copy-files",
|
|
11
|
+
"build:tsc": "tsc && tsc-alias",
|
|
11
12
|
"test": "jest --forceExit --detectOpenHandles",
|
|
12
13
|
"lint": "eslint --ignore-path .gitignore --ext .ts src/",
|
|
13
14
|
"lint:fix": "npm run lint -- --fix",
|
|
@@ -22,25 +23,21 @@
|
|
|
22
23
|
"config": "^3.3.6",
|
|
23
24
|
"cookie-parser": "^1.4.5",
|
|
24
25
|
"cors": "^2.8.5",
|
|
25
|
-
"cross-env": "^7.0.3",
|
|
26
26
|
"dotenv": "^10.0.0",
|
|
27
27
|
"envalid": "^7.1.0",
|
|
28
28
|
"express": "^4.17.1",
|
|
29
29
|
"helmet": "^4.6.0",
|
|
30
30
|
"hpp": "^0.2.3",
|
|
31
|
-
"jest": "^27.0.6",
|
|
32
31
|
"jsonwebtoken": "^8.5.1",
|
|
33
32
|
"morgan": "^1.10.0",
|
|
34
|
-
"pm2": "^5.1.0",
|
|
35
33
|
"swagger-jsdoc": "^6.0.0",
|
|
36
34
|
"swagger-ui-express": "^4.1.6",
|
|
37
|
-
"ts-jest": "^27.0.3",
|
|
38
|
-
"ts-node": "^10.0.0",
|
|
39
|
-
"typescript": "^4.3.5",
|
|
40
35
|
"winston": "^3.3.3",
|
|
41
36
|
"winston-daily-rotate-file": "^4.5.5"
|
|
42
37
|
},
|
|
43
38
|
"devDependencies": {
|
|
39
|
+
"@swc/cli": "^0.1.51",
|
|
40
|
+
"@swc/core": "^1.2.108",
|
|
44
41
|
"@types/bcrypt": "^5.0.0",
|
|
45
42
|
"@types/compression": "^1.7.1",
|
|
46
43
|
"@types/config": "^0.0.39",
|
|
@@ -60,16 +57,23 @@
|
|
|
60
57
|
"@types/winston": "^2.4.4",
|
|
61
58
|
"@typescript-eslint/eslint-plugin": "^4.28.2",
|
|
62
59
|
"@typescript-eslint/parser": "^4.28.2",
|
|
60
|
+
"cross-env": "^7.0.3",
|
|
63
61
|
"eslint": "^7.30.0",
|
|
64
62
|
"eslint-config-prettier": "^8.3.0",
|
|
65
63
|
"eslint-plugin-prettier": "^3.4.0",
|
|
66
64
|
"husky": "^7.0.1",
|
|
65
|
+
"jest": "^27.0.6",
|
|
67
66
|
"lint-staged": "^11.0.0",
|
|
68
67
|
"node-config": "^0.0.2",
|
|
69
68
|
"node-gyp": "^8.1.0",
|
|
70
69
|
"nodemon": "^2.0.9",
|
|
70
|
+
"pm2": "^5.1.0",
|
|
71
71
|
"prettier": "^2.3.2",
|
|
72
72
|
"supertest": "^6.1.3",
|
|
73
|
-
"
|
|
73
|
+
"tsc-alias": "^1.4.1",
|
|
74
|
+
"tsconfig-paths": "^3.10.1",
|
|
75
|
+
"ts-jest": "^27.0.3",
|
|
76
|
+
"ts-node": "^10.0.0",
|
|
77
|
+
"typescript": "^4.3.5"
|
|
74
78
|
}
|
|
75
79
|
}
|
package/lib/default/src/app.ts
CHANGED
|
@@ -1,35 +1,32 @@
|
|
|
1
|
-
# auth API
|
|
2
|
-
|
|
3
|
-
###
|
|
4
1
|
# baseURL
|
|
5
2
|
@baseURL = http://localhost:3000
|
|
6
3
|
|
|
7
4
|
###
|
|
8
|
-
#
|
|
9
|
-
POST {{baseURL}}/signup
|
|
5
|
+
# User Signup
|
|
6
|
+
POST {{ baseURL }}/signup
|
|
10
7
|
Content-Type: application/json
|
|
11
8
|
|
|
12
9
|
{
|
|
13
|
-
"email": "example@
|
|
14
|
-
"password": "
|
|
10
|
+
"email": "example@email.com",
|
|
11
|
+
"password": "password"
|
|
15
12
|
}
|
|
16
13
|
|
|
17
14
|
###
|
|
18
|
-
# Login
|
|
19
|
-
POST {{baseURL}}/login
|
|
15
|
+
# User Login
|
|
16
|
+
POST {{ baseURL }}/login
|
|
20
17
|
Content-Type: application/json
|
|
21
18
|
|
|
22
19
|
{
|
|
23
|
-
"email": "
|
|
24
|
-
"password": "
|
|
20
|
+
"email": "example@email.com",
|
|
21
|
+
"password": "password"
|
|
25
22
|
}
|
|
26
23
|
|
|
27
24
|
###
|
|
28
|
-
# Logout
|
|
29
|
-
POST {{baseURL}}/logout
|
|
25
|
+
# User Logout
|
|
26
|
+
POST {{ baseURL }}/logout
|
|
30
27
|
Content-Type: application/json
|
|
31
28
|
|
|
32
29
|
{
|
|
33
|
-
"email": "
|
|
34
|
-
"password": "
|
|
30
|
+
"email": "example@email.com",
|
|
31
|
+
"password": "password"
|
|
35
32
|
}
|
|
@@ -1,38 +1,34 @@
|
|
|
1
|
-
# users API
|
|
2
|
-
|
|
3
|
-
###
|
|
4
1
|
# baseURL
|
|
5
2
|
@baseURL = http://localhost:3000
|
|
6
3
|
|
|
7
4
|
###
|
|
8
5
|
# Find All Users
|
|
9
|
-
GET {{baseURL}}/users
|
|
6
|
+
GET {{ baseURL }}/users
|
|
10
7
|
|
|
11
8
|
###
|
|
12
9
|
# Find User By Id
|
|
13
|
-
GET {{baseURL}}/users/1
|
|
14
|
-
|
|
10
|
+
GET {{ baseURL }}/users/1
|
|
15
11
|
|
|
16
12
|
###
|
|
17
|
-
#
|
|
18
|
-
POST {{baseURL}}/users
|
|
13
|
+
# Create User
|
|
14
|
+
POST {{ baseURL }}/users
|
|
19
15
|
Content-Type: application/json
|
|
20
16
|
|
|
21
17
|
{
|
|
22
|
-
"email": "example@
|
|
23
|
-
"password": "
|
|
18
|
+
"email": "example@email.com",
|
|
19
|
+
"password": "password"
|
|
24
20
|
}
|
|
25
21
|
|
|
26
22
|
###
|
|
27
|
-
#
|
|
28
|
-
PUT {{baseURL}}/users/1
|
|
23
|
+
# Modify User By Id
|
|
24
|
+
PUT {{ baseURL }}/users/1
|
|
29
25
|
Content-Type: application/json
|
|
30
26
|
|
|
31
27
|
{
|
|
32
|
-
"email": "example@
|
|
33
|
-
"password": "
|
|
28
|
+
"email": "example@email.com",
|
|
29
|
+
"password": "password"
|
|
34
30
|
}
|
|
35
31
|
|
|
36
32
|
###
|
|
37
|
-
#
|
|
38
|
-
DELETE {{baseURL}}/users/1
|
|
33
|
+
# Delete User By Id
|
|
34
|
+
DELETE {{ baseURL }}/users/1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
process.env['NODE_CONFIG_DIR'] = __dirname + '/configs';
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import config from 'config';
|
|
2
2
|
import { NextFunction, Response } from 'express';
|
|
3
|
-
import
|
|
3
|
+
import { verify } from 'jsonwebtoken';
|
|
4
4
|
import { HttpException } from '@exceptions/HttpException';
|
|
5
5
|
import { DataStoredInToken, RequestWithUser } from '@interfaces/auth.interface';
|
|
6
6
|
import userModel from '@models/users.model';
|
|
7
7
|
|
|
8
8
|
const authMiddleware = async (req: RequestWithUser, res: Response, next: NextFunction) => {
|
|
9
9
|
try {
|
|
10
|
-
const Authorization = req.cookies['Authorization'] || req.header('Authorization').split('Bearer ')[1]
|
|
10
|
+
const Authorization = req.cookies['Authorization'] || (req.header('Authorization') ? req.header('Authorization').split('Bearer ')[1] : null);
|
|
11
11
|
|
|
12
12
|
if (Authorization) {
|
|
13
13
|
const secretKey: string = config.get('secretKey');
|
|
14
|
-
const verificationResponse = (await
|
|
14
|
+
const verificationResponse = (await verify(Authorization, secretKey)) as DataStoredInToken;
|
|
15
15
|
const userId = verificationResponse.id;
|
|
16
16
|
const findUser = userModel.find(user => user.id === userId);
|
|
17
17
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { User } from '@interfaces/users.interface';
|
|
2
2
|
|
|
3
|
-
// password:
|
|
3
|
+
// password: password
|
|
4
4
|
const userModel: User[] = [
|
|
5
|
-
{ id: 1, email: '
|
|
6
|
-
{ id: 2, email: '
|
|
7
|
-
{ id: 3, email: '
|
|
8
|
-
{ id: 4, email: '
|
|
5
|
+
{ id: 1, email: 'example1@email.com', password: '$2b$10$TBEfaCe1oo.2jfkBDWcj/usBj4oECsW2wOoDXpCa2IH9xqCpEK/hC' },
|
|
6
|
+
{ id: 2, email: 'example2@email.com', password: '$2b$10$TBEfaCe1oo.2jfkBDWcj/usBj4oECsW2wOoDXpCa2IH9xqCpEK/hC' },
|
|
7
|
+
{ id: 3, email: 'example3@email.com', password: '$2b$10$TBEfaCe1oo.2jfkBDWcj/usBj4oECsW2wOoDXpCa2IH9xqCpEK/hC' },
|
|
8
|
+
{ id: 4, email: 'example4@email.com', password: '$2b$10$TBEfaCe1oo.2jfkBDWcj/usBj4oECsW2wOoDXpCa2IH9xqCpEK/hC' },
|
|
9
9
|
];
|
|
10
10
|
|
|
11
11
|
export default userModel;
|