typescript-express-starter 8.1.3 โ†’ 8.1.7

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 CHANGED
@@ -9,6 +9,12 @@
9
9
 
10
10
  <h4 align="center">๐Ÿš€ ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ ๊ธฐ๋ฐ˜์˜ ์ต์Šคํ”„๋ ˆ์Šค ๋ณด์ผ๋Ÿฌ ํ”Œ๋ ˆ์ดํŠธ ์Šคํƒ€ํ„ฐ ํŒจํ‚ค์ง€</h4>
11
11
 
12
+ <p align ="center">
13
+ <a href="https://nodei.co/npm/typescript-express-starter" target="_blank">
14
+ <img src="https://nodei.co/npm/typescript-express-starter.png" alt="npm ์ •๋ณด" />
15
+ </a>
16
+ </p>
17
+
12
18
  <p align="center">
13
19
  <a href="http://npm.im/typescript-express-starter" target="_blank">
14
20
  <img src="https://img.shields.io/npm/v/typescript-express-starter.svg" alt="npm ๋ฒ„์ „" />
@@ -46,16 +52,6 @@
46
52
  - [๐Ÿ‡บ๐Ÿ‡ธ ์˜์–ด](https://github.com/ljlm0402/typescript-express-starter/blob/master/README.md)
47
53
  - [๐Ÿ‡ฐ๐Ÿ‡ท ํ•œ๊ตญ์–ด](https://github.com/ljlm0402/typescript-express-starter/blob/master/README.kr.md)
48
54
 
49
- > ๋ฒˆ์—ญ์„ ๋„์™€์ฃผ์‹ค ๋ถ„์€ [์ด์Šˆ](https://github.com/ljlm0402/typescript-express-starter/issues/new?assignees=ljlm0402&labels=%F0%9F%92%B1+Translations&template=translations-language---.md&title=) ๋‚จ๊ฒจ์ฃผ์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค. ๐Ÿ’œ
50
-
51
- <br />
52
-
53
- ## ์›น ์‚ฌ์ดํŠธ - ํ”„๋กœ์ ํŠธ ์†Œ๊ฐœ ๋ฐ ํ™๋ณด
54
-
55
- - [๐Ÿ’๐Ÿปโ€โ™‚๏ธ Dylan Iqbal :: A TypeScript Express Starter App](https://bit.ly/3rrZFZ9)
56
-
57
- > ์›น ์‚ฌ์ดํŠธ ๋ฐ ๋ธ”๋กœ๊ทธ์— ์†Œ๊ฐœ๋ฅผ ์›ํ•˜์‹œ๋Š” ๋ถ„์€ [์ด์Šˆ](https://github.com/ljlm0402/typescript-express-starter/issues/new?assignees=ljlm0402&labels=%F0%9F%91%80+Introducetion&template=introducetion-project---.md&title=) ๋‚จ๊ฒจ์ฃผ์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค. ๐Ÿ’™
58
-
59
55
  <br />
60
56
 
61
57
  ## ๐Ÿ˜Ž ํ”„๋กœ์ ํŠธ๋ฅผ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค.
@@ -96,18 +92,19 @@ $ npx typescript-express-starter "project name"
96
92
 
97
93
  #### ํ…œํ”Œ๋ฆฟ ์ข…๋ฅ˜
98
94
 
99
- | ์ด๋ฆ„ | ์„ค๋ช… |
100
- | :------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
101
- | Default | Express ๊ธฐ๋ณธ |
102
- | Routing Controllers | ๋ฐ์ฝ”๋ ˆ์ดํ„ฐ ์‚ฌ์šฉ๋Ÿ‰์ด ๋งŽ์€ ๊ตฌ์กฐํ™”๋˜๊ณ  ์„ ์–ธ์ ์ด๋ฉฐ ์•„๋ฆ„๋‹ต๊ฒŒ ๊ตฌ์„ฑ๋œ ํด๋ž˜์Šค ๊ธฐ๋ฐ˜ ์ปจํŠธ๋กค๋Ÿฌ ์ƒ์„ฑ |
103
- | Sequelize | PostgreSQL, MySQL, MariaDB, SQLite, Microsoft SQL Server๋ฅผ ์ง€์›ํ•˜๋Š” Promise ํŒจํ„ด ๊ธฐ๋ฐ˜์˜ Node.js ORM |
104
- | Mongoose | Node.js์™€ MongoDB๋ฅผ ์œ„ํ•œ ODM(Object Data Mapping) ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ |
105
- | TypeORM | ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ, ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ๊ณผ ํ•จ๊ป˜ ์‚ฌ์šฉ๋˜์–ด Node.js, React Native, Expo์—์„œ ์‹คํ–‰๋  ์ˆ˜ ์žˆ๋Š” ORM |
106
- | Prisma | ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ๋ฐ์ดํ„ฐ๋ฅผ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด์˜ ๊ฐ์ฒด์™€ ๋งคํ•‘ํ•˜์—ฌ ๊ธฐ์กด์— SQL๋กœ ์ž‘์„ฑํ•˜๋˜ ๋ฐ์ดํ„ฐ๋ฅผ ์ˆ˜์ •, ํ…Œ์ด๋ธ” ๊ตฌ์กฐ ๋ณ€๊ฒฝ๋“ฑ์˜ ์ž‘์—…์„ ๊ฐ์ฒด๋ฅผ ํ†ตํ•ด ํ”„๋กœ๊ทธ๋ž˜๋ฐ์ ์œผ๋กœ ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ด์ฃผ๋Š” ORM |
107
- | Knex | ์ฟผ๋ฆฌ ๋นŒ๋”๋ฅผ ์œ„ํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ |
108
- | GraphQL | API ์šฉ ์ฟผ๋ฆฌ ์–ธ์–ด์ด๋ฉฐ ๊ธฐ์กด ๋ฐ์ดํ„ฐ๋กœ ์ด๋Ÿฌํ•œ ์ฟผ๋ฆฌ๋ฅผ ์ˆ˜ํ–‰ํ•˜๊ธฐ์œ„ํ•œ ๋Ÿฐํƒ€์ž„ |
109
- | Typegoose | ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ ํด๋ž˜์Šค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ชฝ๊ตฌ์Šค ๋ชจ๋ธ ์ •์˜ |
110
- | mikro-orm (๊ฐœ๋ฐœ์ค‘) | ๋ฐ์ดํ„ฐ ๋งคํผ, ์ž‘์—… ๋‹จ์œ„ ๋ฐ ์•„์ด๋ดํ‹ฐํ‹ฐ ๋งต ํŒจํ„ด์„ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•˜๋Š” Node.js์šฉ TypeScript ORM. MongoDB, MySQL, MariaDB, PostgreSQL ๋ฐ SQLite ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. |
95
+ | ์ด๋ฆ„ | ์„ค๋ช… |
96
+ | :-------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
97
+ | Default | Express ๊ธฐ๋ณธ |
98
+ | [Routing Controllers](https://github.com/typestack/routing-controllers) | ๋ฐ์ฝ”๋ ˆ์ดํ„ฐ ์‚ฌ์šฉ๋Ÿ‰์ด ๋งŽ์€ ๊ตฌ์กฐํ™”๋˜๊ณ  ์„ ์–ธ์ ์ด๋ฉฐ ์•„๋ฆ„๋‹ต๊ฒŒ ๊ตฌ์„ฑ๋œ ํด๋ž˜์Šค ๊ธฐ๋ฐ˜ ์ปจํŠธ๋กค๋Ÿฌ ์ƒ์„ฑ |
99
+ | [Sequelize](https://github.com/sequelize/sequelize) | PostgreSQL, MySQL, MariaDB, SQLite, Microsoft SQL Server๋ฅผ ์ง€์›ํ•˜๋Š” Promise ํŒจํ„ด ๊ธฐ๋ฐ˜์˜ Node.js ORM |
100
+ | [Mongoose](https://github.com/Automattic/mongoose) | Node.js์™€ MongoDB๋ฅผ ์œ„ํ•œ ODM(Object Data Mapping) ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ |
101
+ | [TypeORM](https://github.com/typeorm/typeorm) | ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ, ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ๊ณผ ํ•จ๊ป˜ ์‚ฌ์šฉ๋˜์–ด Node.js, React Native, Expo์—์„œ ์‹คํ–‰๋  ์ˆ˜ ์žˆ๋Š” ORM |
102
+ | [Prisma](https://github.com/prisma/prisma) | ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ๋ฐ์ดํ„ฐ๋ฅผ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด์˜ ๊ฐ์ฒด์™€ ๋งคํ•‘ํ•˜์—ฌ ๊ธฐ์กด์— SQL๋กœ ์ž‘์„ฑํ•˜๋˜ ๋ฐ์ดํ„ฐ๋ฅผ ์ˆ˜์ •, ํ…Œ์ด๋ธ” ๊ตฌ์กฐ ๋ณ€๊ฒฝ๋“ฑ์˜ ์ž‘์—…์„ ๊ฐ์ฒด๋ฅผ ํ†ตํ•ด ํ”„๋กœ๊ทธ๋ž˜๋ฐ์ ์œผ๋กœ ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ด์ฃผ๋Š” ORM |
103
+ | [Knex](https://github.com/knex/knex) | ์ฟผ๋ฆฌ ๋นŒ๋”๋ฅผ ์œ„ํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ |
104
+ | [GraphQL](https://github.com/graphql/graphql-js) | API ์šฉ ์ฟผ๋ฆฌ ์–ธ์–ด์ด๋ฉฐ ๊ธฐ์กด ๋ฐ์ดํ„ฐ๋กœ ์ด๋Ÿฌํ•œ ์ฟผ๋ฆฌ๋ฅผ ์ˆ˜ํ–‰ํ•˜๊ธฐ์œ„ํ•œ ๋Ÿฐํƒ€์ž„ |
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 ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ์ง€์› |
107
+ | [Sequelize Typescript](https://github.com/RobinBuschmann/sequelize-typescript) (๊ฐœ๋ฐœ์ค‘) | ๋ฐ์ฝ”๋ ˆ์ดํ„ฐ ๋ฐ Sequelize๋ฅผ ์œ„ํ•œ ๋ช‡ ๊ฐ€์ง€ ๊ธฐ๋Šฅ |
111
108
 
112
109
  ## ๐Ÿ›Ž Script ๋ช…๋ น์–ด
113
110
 
package/README.md CHANGED
@@ -9,6 +9,12 @@
9
9
 
10
10
  <h4 align="center">๐Ÿš€ Express RESTful API Boilerplate Using TypeScript</h4>
11
11
 
12
+ <p align ="center">
13
+ <a href="https://nodei.co/npm/typescript-express-starter" target="_blank">
14
+ <img src="https://nodei.co/npm/typescript-express-starter.png" alt="npm Info" />
15
+ </a>
16
+ </p>
17
+
12
18
  <p align="center">
13
19
  <a href="http://npm.im/typescript-express-starter" target="_blank">
14
20
  <img src="https://img.shields.io/npm/v/typescript-express-starter.svg" alt="npm Version" />
@@ -46,16 +52,6 @@
46
52
  - [๐Ÿ‡บ๐Ÿ‡ธ English](https://github.com/ljlm0402/typescript-express-starter/blob/master/README.md)
47
53
  - [๐Ÿ‡ฐ๐Ÿ‡ท Korean](https://github.com/ljlm0402/typescript-express-starter/blob/master/README.kr.md)
48
54
 
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
-
51
- <br />
52
-
53
- ## Web Site - Project Introduction
54
-
55
- - [๐Ÿ’๐Ÿปโ€โ™‚๏ธ Dylan Iqbal :: A TypeScript Express Starter App](https://bit.ly/3rrZFZ9)
56
-
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
-
59
55
  <br />
60
56
 
61
57
  ## ๐Ÿ˜Ž Introducing The Project
@@ -100,18 +96,19 @@ Start your typescript-express-starter app in development mode at `http://localho
100
96
 
101
97
  #### Template Type
102
98
 
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 |
114
- | 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. |
99
+ | Name | Description |
100
+ | :--------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------- |
101
+ | Default | Express Default |
102
+ | [Routing Controllers](https://github.com/typestack/routing-controllers) | Create structured, declarative and beautifully organized class-based controllers with heavy decorators usage |
103
+ | [Sequelize](https://github.com/sequelize/sequelize) | Easy to use multi SQL dialect ORM for Node.js |
104
+ | [Mongoose](https://github.com/Automattic/mongoose) | MongoDB Object Modeling(ODM) designed to work in an asynchronous environment |
105
+ | [TypeORM](https://github.com/typeorm/typeorm) | An ORM that can run in Node.js and Others |
106
+ | [Prisma](https://github.com/prisma/prisma) | Modern Database Access for TypeScript & Node.js |
107
+ | [Knex](https://github.com/knex/knex) | SQL query builder for Postgres, MySQL, MariaDB, SQLite3 and Oracle |
108
+ | [GraphQL](https://github.com/graphql/graphql-js) | query language for APIs and a runtime for fulfilling those queries with your existing data |
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 |
111
+ | [Sequelize Typescript](https://github.com/RobinBuschmann/sequelize-typescript) (Develop) | Decorators and some other features for sequelize |
115
112
 
116
113
  ## ๐Ÿ›Ž Available Commands for the Server
117
114
 
@@ -1,6 +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
1
16
  build:
2
- docker build -t ${tag} .
17
+ docker build -t ${APP_NAME}\
18
+ --target production-build-stage\
19
+ -f Dockerfile .
20
+
21
+ # Clean the container image
3
22
  clean:
4
- docker rmi -f ${tag}
23
+ docker rmi -f ${APP_NAME}
24
+
25
+ # Run the container image
5
26
  run:
6
- docker run -d -p ${port}:${port} --name ${name} ${tag}
27
+ docker run -d -it -p 3000:3000 ${APP_NAME}
28
+
29
+ all: build
@@ -7,8 +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": "tsc && tsc-alias",
11
- "build:swc": "swc src -d dist --source-maps --copy-files",
10
+ "build": "swc src -d dist --source-maps --copy-files",
11
+ "build:tsc": "tsc && tsc-alias",
12
12
  "test": "jest --forceExit --detectOpenHandles",
13
13
  "lint": "eslint --ignore-path .gitignore --ext .ts src/",
14
14
  "lint:fix": "npm run lint -- --fix",
@@ -3,7 +3,7 @@ PORT = 3000
3
3
 
4
4
  # DATABASE
5
5
  DB_HOST = localhost
6
- DB_PORT = 3306
6
+ DB_PORT = 5432
7
7
  DB_USER = root
8
8
  DB_PASSWORD = password
9
9
  DB_DATABASE = test
@@ -16,5 +16,5 @@ LOG_FORMAT = dev
16
16
  LOG_DIR = ../logs
17
17
 
18
18
  # CORS
19
- ORIGIN = *
19
+ ORIGIN = true
20
20
  CREDENTIALS = true
@@ -3,7 +3,7 @@ PORT = 3000
3
3
 
4
4
  # DATABASE
5
5
  DB_HOST = localhost
6
- DB_PORT = 3306
6
+ DB_PORT = 5432
7
7
  DB_USER = root
8
8
  DB_PASSWORD = password
9
9
  DB_DATABASE = test
@@ -16,5 +16,5 @@ LOG_FORMAT = combined
16
16
  LOG_DIR = ../logs
17
17
 
18
18
  # CORS
19
- ORIGIN = your.domain.com
19
+ ORIGIN = false
20
20
  CREDENTIALS = true
@@ -3,7 +3,7 @@ PORT = 3000
3
3
 
4
4
  # DATABASE
5
5
  DB_HOST = localhost
6
- DB_PORT = 3306
6
+ DB_PORT = 5432
7
7
  DB_USER = root
8
8
  DB_PASSWORD = password
9
9
  DB_DATABASE = test
@@ -16,5 +16,5 @@ LOG_FORMAT = dev
16
16
  LOG_DIR = ../logs
17
17
 
18
18
  # CORS
19
- ORIGIN = *
19
+ ORIGIN = true
20
20
  CREDENTIALS = true
@@ -1,6 +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
1
16
  build:
2
- docker build -t ${tag} .
17
+ docker build -t ${APP_NAME}\
18
+ --target production-build-stage\
19
+ -f Dockerfile .
20
+
21
+ # Clean the container image
3
22
  clean:
4
- docker rmi -f ${tag}
23
+ docker rmi -f ${APP_NAME}
24
+
25
+ # Run the container image
5
26
  run:
6
- docker run -d -p ${port}:${port} --name ${name} ${tag}
27
+ docker run -d -it -p 3000:3000 ${APP_NAME}
28
+
29
+ all: build
@@ -7,8 +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": "tsc && tsc-alias",
11
- "build:swc": "swc src -d dist --source-maps --copy-files",
10
+ "build": "swc src -d dist --source-maps --copy-files",
11
+ "build:tsc": "tsc && tsc-alias",
12
12
  "test": "jest --forceExit --detectOpenHandles",
13
13
  "lint": "eslint --ignore-path .gitignore --ext .ts src/",
14
14
  "lint:fix": "npm run lint -- --fix",
@@ -50,9 +50,12 @@ class App {
50
50
  }
51
51
 
52
52
  private initializeMiddlewares() {
53
+ if (this.env === 'production') {
54
+ this.app.use(hpp());
55
+ this.app.use(helmet());
56
+ }
57
+
53
58
  this.app.use(cors({ origin: ORIGIN, credentials: CREDENTIALS }));
54
- this.app.use(hpp());
55
- this.app.use(helmet());
56
59
  this.app.use(compression());
57
60
  this.app.use(express.json());
58
61
  this.app.use(express.urlencoded({ extended: true }));
@@ -68,7 +71,7 @@ class App {
68
71
  const apolloServer = new ApolloServer({
69
72
  schema: schema,
70
73
  plugins: [
71
- NODE_ENV === 'production'
74
+ this.env === 'production'
72
75
  ? ApolloServerPluginLandingPageProductionDefault({ footer: false })
73
76
  : ApolloServerPluginLandingPageLocalDefault({ footer: false }),
74
77
  ],
@@ -2,4 +2,5 @@ import { config } from 'dotenv';
2
2
  config({ path: `.env.${process.env.NODE_ENV || 'development'}.local` });
3
3
 
4
4
  export const CREDENTIALS = process.env.CREDENTIALS === 'true';
5
- export const { NODE_ENV, PORT, DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, DB_DATABASE, SECRET_KEY, LOG_FORMAT, LOG_DIR, ORIGIN } = process.env;
5
+ export const ORIGIN = process.env.ORIGIN === 'true';
6
+ export const { NODE_ENV, PORT, DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, DB_DATABASE, SECRET_KEY, LOG_FORMAT, LOG_DIR } = process.env;
@@ -9,7 +9,7 @@ export class UserEntity extends BaseEntity implements User {
9
9
 
10
10
  @Column()
11
11
  @IsNotEmpty()
12
- @Unique()
12
+ @Unique(['email'])
13
13
  email: string;
14
14
 
15
15
  @Column()
@@ -18,7 +18,7 @@ export default class AuthRepository {
18
18
  if (findUser) throw new HttpException(409, `You're email ${userData.email} already exists`);
19
19
 
20
20
  const hashedPassword = await hash(userData.password, 10);
21
- const createUserData: User = await UserEntity.save({ ...userData, password: hashedPassword });
21
+ const createUserData: User = await UserEntity.create({ ...userData, password: hashedPassword }).save();
22
22
 
23
23
  return createUserData;
24
24
  }
@@ -30,7 +30,7 @@ export default class UserRepository {
30
30
  if (findUser) throw new HttpException(409, `You're email ${userData.email} already exists`);
31
31
 
32
32
  const hashedPassword = await hash(userData.password, 10);
33
- const createUserData: User = await UserEntity.save({ ...userData, password: hashedPassword });
33
+ const createUserData: User = await UserEntity.create({ ...userData, password: hashedPassword }).save();
34
34
 
35
35
  return createUserData;
36
36
  }
package/lib/knex/Makefile CHANGED
@@ -1,6 +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
1
16
  build:
2
- docker build -t ${tag} .
17
+ docker build -t ${APP_NAME}\
18
+ --target production-build-stage\
19
+ -f Dockerfile .
20
+
21
+ # Clean the container image
3
22
  clean:
4
- docker rmi -f ${tag}
23
+ docker rmi -f ${APP_NAME}
24
+
25
+ # Run the container image
5
26
  run:
6
- docker run -d -p ${port}:${port} --name ${name} ${tag}
27
+ docker run -d -it -p 3000:3000 ${APP_NAME}
28
+
29
+ all: build
@@ -7,8 +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": "tsc && tsc-alias",
11
- "build:swc": "swc src -d dist --source-maps --copy-files",
10
+ "build": "swc src -d dist --source-maps --copy-files",
11
+ "build:tsc": "tsc && tsc-alias",
12
12
  "test": "jest --forceExit --detectOpenHandles",
13
13
  "lint": "eslint --ignore-path .gitignore --ext .ts src/",
14
14
  "lint:fix": "npm run lint -- --fix",
@@ -1,6 +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
1
16
  build:
2
- docker build -t ${tag} .
17
+ docker build -t ${APP_NAME}\
18
+ --target production-build-stage\
19
+ -f Dockerfile .
20
+
21
+ # Clean the container image
3
22
  clean:
4
- docker rmi -f ${tag}
23
+ docker rmi -f ${APP_NAME}
24
+
25
+ # Run the container image
5
26
  run:
6
- docker run -d -p ${port}:${port} --name ${name} ${tag}
27
+ docker run -d -it -p 3000:3000 ${APP_NAME}
28
+
29
+ all: build
@@ -7,8 +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": "tsc && tsc-alias",
11
- "build:swc": "swc src -d dist --source-maps --copy-files",
10
+ "build": "swc src -d dist --source-maps --copy-files",
11
+ "build:tsc": "tsc && tsc-alias",
12
12
  "test": "jest --forceExit --detectOpenHandles",
13
13
  "lint": "eslint --ignore-path .gitignore --ext .ts src/",
14
14
  "lint:fix": "npm run lint -- --fix",
@@ -1,6 +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
1
16
  build:
2
- docker build -t ${tag} .
17
+ docker build -t ${APP_NAME}\
18
+ --target production-build-stage\
19
+ -f Dockerfile .
20
+
21
+ # Clean the container image
3
22
  clean:
4
- docker rmi -f ${tag}
23
+ docker rmi -f ${APP_NAME}
24
+
25
+ # Run the container image
5
26
  run:
6
- docker run -d -p ${port}:${port} --name ${name} ${tag}
27
+ docker run -d -it -p 3000:3000 ${APP_NAME}
28
+
29
+ all: build
@@ -7,8 +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": "tsc && tsc-alias",
11
- "build:swc": "swc src -d dist --source-maps --copy-files",
10
+ "build": "swc src -d dist --source-maps --copy-files",
11
+ "build:tsc": "tsc && tsc-alias",
12
12
  "test": "jest --forceExit --detectOpenHandles",
13
13
  "lint": "eslint --ignore-path .gitignore --ext .ts src/",
14
14
  "lint:fix": "npm run lint -- --fix",
@@ -1,6 +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
1
16
  build:
2
- docker build -t ${tag} .
17
+ docker build -t ${APP_NAME}\
18
+ --target production-build-stage\
19
+ -f Dockerfile .
20
+
21
+ # Clean the container image
3
22
  clean:
4
- docker rmi -f ${tag}
23
+ docker rmi -f ${APP_NAME}
24
+
25
+ # Run the container image
5
26
  run:
6
- docker run -d -p ${port}:${port} --name ${name} ${tag}
27
+ docker run -d -it -p 3000:3000 ${APP_NAME}
28
+
29
+ all: build
@@ -7,8 +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": "tsc && tsc-alias",
11
- "build:swc": "swc src -d dist --source-maps --copy-files",
10
+ "build": "swc src -d dist --source-maps --copy-files",
11
+ "build:tsc": "tsc && tsc-alias",
12
12
  "test": "jest --forceExit --detectOpenHandles",
13
13
  "lint": "eslint --ignore-path .gitignore --ext .ts src/",
14
14
  "lint:fix": "npm run lint -- --fix",
@@ -1,6 +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
1
16
  build:
2
- docker build -t ${tag} .
17
+ docker build -t ${APP_NAME}\
18
+ --target production-build-stage\
19
+ -f Dockerfile .
20
+
21
+ # Clean the container image
3
22
  clean:
4
- docker rmi -f ${tag}
23
+ docker rmi -f ${APP_NAME}
24
+
25
+ # Run the container image
5
26
  run:
6
- docker run -d -p ${port}:${port} --name ${name} ${tag}
27
+ docker run -d -it -p 3000:3000 ${APP_NAME}
28
+
29
+ all: build
@@ -7,8 +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": "tsc && tsc-alias",
11
- "build:swc": "swc src -d dist --source-maps --copy-files",
10
+ "build": "swc src -d dist --source-maps --copy-files",
11
+ "build:tsc": "tsc && tsc-alias",
12
12
  "test": "jest --forceExit --detectOpenHandles",
13
13
  "lint": "eslint --ignore-path .gitignore --ext .ts src/",
14
14
  "lint:fix": "npm run lint -- --fix",
package/lib/starter.js CHANGED
@@ -29,7 +29,8 @@ const createProject = async (projectName) => {
29
29
 
30
30
  try {
31
31
  const template = await chooseTemplates();
32
- const { isUpdated, isDeduped } = await setupModuleManagement();
32
+ const isUpdated = await dependenciesUpdates();
33
+ const isDeduped = await dependenciesDeduped();
33
34
 
34
35
  console.log("[ 1 / 3 ] ๐Ÿ” copying project...");
35
36
  console.log("[ 2 / 3 ] ๐Ÿšš fetching node_modules...");
@@ -91,29 +92,50 @@ const chooseTemplates = async () => {
91
92
  };
92
93
 
93
94
  /**
94
- * @method setupModuleManagement
95
- * @description Set up npm management features.
95
+ * @method dependenciesUpdates
96
+ * @description npm dependencies updated.
96
97
  */
97
- const setupModuleManagement = async () => {
98
+ const dependenciesUpdates = async () => {
98
99
  const { isUpdated } = await inquirer.prompt([
99
100
  {
100
101
  type: "confirm",
101
102
  name: "isUpdated",
102
103
  message:
103
- "This command will update all the packages listed to the latest version.",
104
+ "Do you want to update all packages in the node_modules directory and dependency ?"
104
105
  },
105
106
  ]);
106
107
 
108
+ if (isUpdated) {
109
+ const { isUpdatedReconfirm } = await inquirer.prompt([
110
+ {
111
+ type: "confirm",
112
+ name: "isUpdatedReconfirm",
113
+ message:
114
+ "However, updating to the latest version may cause package dependency issues. Do you still want to update ?"
115
+ },
116
+ ]);
117
+
118
+ return isUpdatedReconfirm;
119
+ }
120
+
121
+ return false;
122
+ };
123
+
124
+ /**
125
+ * @method dependenciesDeduped
126
+ * @description npm duplicate dependencies removed.
127
+ */
128
+ const dependenciesDeduped = async () => {
107
129
  const { isDeduped } = await inquirer.prompt([
108
130
  {
109
131
  type: "confirm",
110
132
  name: "isDeduped",
111
- message: "It is used to clean up duplicate packages in npm.",
133
+ message: "Used to removed duplicate packages at npm. Do you want to ?",
112
134
  },
113
135
  ]);
114
136
 
115
- return { isUpdated, isDeduped };
116
- };
137
+ return isDeduped;
138
+ }
117
139
 
118
140
  /**
119
141
  * @method copyProjectFiles
@@ -1,6 +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
1
16
  build:
2
- docker build -t ${tag} .
17
+ docker build -t ${APP_NAME}\
18
+ --target production-build-stage\
19
+ -f Dockerfile .
20
+
21
+ # Clean the container image
3
22
  clean:
4
- docker rmi -f ${tag}
23
+ docker rmi -f ${APP_NAME}
24
+
25
+ # Run the container image
5
26
  run:
6
- docker run -d -p ${port}:${port} --name ${name} ${tag}
27
+ docker run -d -it -p 3000:3000 ${APP_NAME}
28
+
29
+ all: build
@@ -7,8 +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": "tsc && tsc-alias",
11
- "build:swc": "swc src -d dist --source-maps --copy-files",
10
+ "build": "swc src -d dist --source-maps --copy-files",
11
+ "build:tsc": "tsc && tsc-alias",
12
12
  "test": "jest --forceExit --detectOpenHandles",
13
13
  "lint": "eslint --ignore-path .gitignore --ext .ts src/",
14
14
  "lint:fix": "npm run lint -- --fix",
@@ -1,6 +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
1
16
  build:
2
- docker build -t ${tag} .
17
+ docker build -t ${APP_NAME}\
18
+ --target production-build-stage\
19
+ -f Dockerfile .
20
+
21
+ # Clean the container image
3
22
  clean:
4
- docker rmi -f ${tag}
23
+ docker rmi -f ${APP_NAME}
24
+
25
+ # Run the container image
5
26
  run:
6
- docker run -d -p ${port}:${port} --name ${name} ${tag}
27
+ docker run -d -it -p 3000:3000 ${APP_NAME}
28
+
29
+ all: build
@@ -7,8 +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": "tsc && tsc-alias",
11
- "build:swc": "swc src -d dist --source-maps --copy-files",
10
+ "build": "swc src -d dist --source-maps --copy-files",
11
+ "build:tsc": "tsc && tsc-alias",
12
12
  "test": "jest --forceExit --detectOpenHandles",
13
13
  "lint": "eslint --ignore-path .gitignore --ext .ts src/",
14
14
  "lint:fix": "npm run lint -- --fix",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typescript-express-starter",
3
- "version": "8.1.3",
3
+ "version": "8.1.7",
4
4
  "description": "Quick and Easy TypeScript Express Starter",
5
5
  "author": "AGUMON <ljlm0402@gmail.com>",
6
6
  "license": "MIT",