-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from ljlm0402/development
🌼 Update Version - v6.0.0
- Loading branch information
Showing
60 changed files
with
1,537 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# compiled output | ||
.vscode | ||
/node_modules | ||
|
||
# code formatter | ||
.eslintrc | ||
.eslintignore | ||
.editorconfig | ||
.huskyrc | ||
.lintstagedrc.json | ||
.prettierrc | ||
|
||
# test | ||
jest.config.js | ||
|
||
# docker | ||
Dockerfile | ||
docker-compose.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PORT=3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"extends": ["prettier", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"], | ||
"parserOptions": { | ||
"ecmaVersion": 2018, | ||
"sourceType": "module" | ||
}, | ||
"rules": { | ||
"@typescript-eslint/explicit-member-accessibility": 0, | ||
"@typescript-eslint/explicit-function-return-type": 0, | ||
"@typescript-eslint/no-parameter-properties": 0, | ||
"@typescript-eslint/interface-name-prefix": 0, | ||
"@typescript-eslint/explicit-module-boundary-types": 0, | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/ban-types": "off", | ||
"@typescript-eslint/no-var-requires": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"*.ts": [ | ||
"npm run lint" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"printWidth": 150, | ||
"tabWidth": 2, | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"semi": true, | ||
"arrowParens": "avoid" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node-terminal", | ||
"request": "launch", | ||
"name": "Dev typescript-express-starter", | ||
"command": "npm run dev" | ||
}, | ||
{ | ||
"type": "node-terminal", | ||
"request": "launch", | ||
"name": "Start typescript-express-starter", | ||
"command": "npm run start" | ||
}, | ||
{ | ||
"type": "node-terminal", | ||
"request": "launch", | ||
"name": "Test typescript-express-starter", | ||
"command": "npm run test" | ||
}, | ||
{ | ||
"type": "node-terminal", | ||
"request": "launch", | ||
"name": "Lint typescript-express-starter", | ||
"command": "npm run lint" | ||
}, | ||
{ | ||
"type": "node-terminal", | ||
"request": "launch", | ||
"name": "Lint:Fix typescript-express-starter", | ||
"command": "npm run lint:fix" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": true | ||
}, | ||
"editor.formatOnSave": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Common build stage | ||
FROM node:14.14.0-alpine3.12 as common-build-stage | ||
|
||
COPY . ./app | ||
|
||
WORKDIR /app | ||
|
||
RUN npm install | ||
|
||
EXPOSE 3000 | ||
|
||
# Dvelopment build stage | ||
FROM common-build-stage as development-build-stage | ||
|
||
ENV NODE_ENV development | ||
|
||
CMD ["npm", "run", "dev"] | ||
|
||
# Production build stage | ||
FROM common-build-stage as production-build-stage | ||
|
||
ENV NODE_ENV production | ||
|
||
CMD ["npm", "run", "start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
build: | ||
docker build -t ${tag} . | ||
clean: | ||
docker rmi -f ${tag} | ||
run: | ||
docker run -d -p ${port}:${port} --name ${name} ${tag} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
version: '3.7' | ||
|
||
services: | ||
proxy: | ||
image: nginx:alpine | ||
container_name: proxy | ||
ports: | ||
- '80:80' | ||
volumes: | ||
- ./nginx.conf:/etc/nginx/nginx.conf | ||
restart: 'unless-stopped' | ||
networks: | ||
- backend | ||
server: | ||
build: | ||
context: ./ | ||
target: development-build-stage | ||
dockerfile: Dockerfile | ||
container_name: server | ||
ports: | ||
- '3000:3000' | ||
volumes: | ||
- ./:/app | ||
- /app/node_modules | ||
restart: 'unless-stopped' | ||
networks: | ||
- backend | ||
links: | ||
- mysql | ||
depends_on: | ||
- mysql | ||
mysql: | ||
image: mysql:5.7 | ||
container_name: mysql | ||
environment: | ||
MYSQL_ROOT_USER: root | ||
MYSQL_ROOT_PASSWORD: password | ||
MYSQL_DATABASE: test | ||
ports: | ||
- '3306:3306' | ||
networks: | ||
- backend | ||
|
||
networks: | ||
backend: | ||
driver: bridge | ||
|
||
volumes: | ||
data: | ||
driver: local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
module.exports = { | ||
apps: [ | ||
{ | ||
name: 'myapp', | ||
// package.json에 정의된 npm run start를 실행하게 해서 PM2로 관리하게 한다. | ||
script: 'npm', | ||
args: 'run dev', | ||
instances: 2, | ||
autorestart: true, | ||
watch: false, | ||
max_memory_restart: '1G', | ||
// development mode | ||
// pm2 start ecosystem.config.js | ||
env: { | ||
HOST: '0.0.0.0', | ||
PORT: 3000, | ||
NODE_ENV: 'development' | ||
}, | ||
// production mode | ||
// pm2 start ecosystem.config.js --env production | ||
env_production: { | ||
HOST: '0.0.0.0', | ||
PORT: 3000, | ||
NODE_ENV: 'production' | ||
}, | ||
output: './logs/console.log', | ||
error: './logs/consoleError.log' | ||
} | ||
], | ||
|
||
deploy: { | ||
production: { | ||
// sample | ||
user: 'node', | ||
host: '123.12.123.1', | ||
ref: 'origin/master', | ||
repo: '[email protected]:repo.git', | ||
path: '/var/www/production', | ||
'post-deploy': | ||
'npm install && pm2 reload ecosystem.config.js --env production' | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const { pathsToModuleNameMapper } = require('ts-jest/utils'); | ||
const { compilerOptions } = require('./tsconfig.json'); | ||
|
||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
roots: ['<rootDir>/src'], | ||
transform: { | ||
'^.+\\.tsx?$': 'ts-jest', | ||
}, | ||
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/src' }), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
process.env['NODE_CONFIG_DIR'] = __dirname + '/src/configs'; | ||
|
||
import config from 'config'; | ||
import { dbConfig } from './src/interfaces/db.interface'; | ||
|
||
const db: dbConfig = config.get('dbConfig'); | ||
export = { | ||
client: 'mysql', | ||
connection: { | ||
charset: 'utf8', | ||
timezone: 'UTC', | ||
host: db.host, | ||
user: db.user, | ||
password: db.password, | ||
database: db.database, | ||
port: db.port, | ||
}, | ||
migrations: { | ||
directory: 'src/databases/migrations', | ||
tableName: 'migrations', | ||
// stub: 'src/databases/stubs', | ||
}, | ||
seeds: { | ||
directory: 'src/databases/seeds', | ||
// stub: 'src/databases/stubs', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
user nginx; | ||
worker_processes 1; | ||
|
||
error_log /var/log/nginx/error.log warn; | ||
pid /var/run/nginx.pid; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
upstream api-server { | ||
server server:3000; | ||
keepalive 100; | ||
} | ||
|
||
server { | ||
listen 80; | ||
server_name localhost; | ||
|
||
location / { | ||
proxy_http_version 1.1; | ||
proxy_pass http://api-server; | ||
} | ||
|
||
} | ||
|
||
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
'$status $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
|
||
access_log /var/log/nginx/access.log main; | ||
|
||
sendfile on; | ||
keepalive_timeout 65; | ||
include /etc/nginx/conf.d/*.conf; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"watch": [ | ||
"src", | ||
".env" | ||
], | ||
"ext": "js,ts,json", | ||
"ignore": [ | ||
"src/**/*.spec.ts", | ||
"src/**/*.test.ts" | ||
], | ||
"exec": "ts-node -r tsconfig-paths/register --transpile-only src/server.ts" | ||
} |
Oops, something went wrong.