-
Notifications
You must be signed in to change notification settings - Fork 3
Rest 서버 개발 환경 설정 #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
The head ref may contain hidden characters: "2-be-\uAC1C\uBC1C-\uD658\uACBD-\uC124\uC815"
Merged
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d749407
chore: nestjs 서버 생성
anzmin bc6184b
chore: eslint, prettier 설정
anzmin fc8e217
chore: 사용하지 않는 파일 제거
anzmin 3f102f3
chore: env 환경 변수 설정
anzmin 05f3c8f
chore: typeorm 옵션 설정
anzmin baa7479
chore: config file alias 설정
anzmin 29bbb3a
chore: swagger 설정
anzmin d99b97d
chore: 기타 미들웨어 설정
anzmin 97f54f6
chore: ts path config option 분리
anzmin afb3b67
chore: ts esinterop 설정 추가
anzmin 6bf41d0
fix: BE - helmet middleware가 적용되지 않는 오류 수정
anzmin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,22 @@ | ||
| module.exports = { | ||
| parser: '@typescript-eslint/parser', | ||
| parserOptions: { | ||
| project: 'tsconfig.json', | ||
| tsconfigRootDir: __dirname, | ||
| sourceType: 'module', | ||
| }, | ||
| plugins: ['@typescript-eslint/eslint-plugin'], | ||
| extends: ['plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'], | ||
| root: true, | ||
| env: { | ||
| node: true, | ||
| jest: true, | ||
| }, | ||
| ignorePatterns: ['.eslintrc.js'], | ||
| rules: { | ||
| '@typescript-eslint/interface-name-prefix': 'off', | ||
| '@typescript-eslint/explicit-function-return-type': 'off', | ||
| '@typescript-eslint/explicit-module-boundary-types': 'off', | ||
| '@typescript-eslint/no-explicit-any': 'off' | ||
| }, | ||
| }; |
This file contains hidden or 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 @@ | ||
| # compiled output | ||
| /dist | ||
| /node_modules | ||
|
|
||
| # Logs | ||
| logs | ||
| *.log | ||
| npm-debug.log* | ||
| pnpm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| lerna-debug.log* | ||
|
|
||
| # OS | ||
| .DS_Store | ||
|
|
||
| # Tests | ||
| /coverage | ||
| /.nyc_output | ||
|
|
||
| # IDEs and editors | ||
| /.idea | ||
| .project | ||
| .classpath | ||
| .c9/ | ||
| *.launch | ||
| .settings/ | ||
| *.sublime-workspace | ||
|
|
||
| # IDE - VSCode | ||
| .vscode/* | ||
| !.vscode/settings.json | ||
| !.vscode/tasks.json | ||
| !.vscode/launch.json | ||
| !.vscode/extensions.json |
This file contains hidden or 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 @@ | ||
| { | ||
| "singleQuote": true, | ||
| "parser": "typescript", | ||
| "semi": true, | ||
| "useTabs": true, | ||
| "printWidth": 100, | ||
| "tabWidth": 4 | ||
| } |
This file contains hidden or 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,73 @@ | ||
| <p align="center"> | ||
| <a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="200" alt="Nest Logo" /></a> | ||
| </p> | ||
|
|
||
| [circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456 | ||
| [circleci-url]: https://circleci.com/gh/nestjs/nest | ||
|
|
||
| <p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p> | ||
| <p align="center"> | ||
| <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a> | ||
| <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a> | ||
| <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a> | ||
| <a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a> | ||
| <a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a> | ||
| <a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a> | ||
| <a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a> | ||
| <a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a> | ||
| <a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a> | ||
| <a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a> | ||
| <a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a> | ||
| </p> | ||
| <!--[](https://opencollective.com/nest#backer) | ||
| [](https://opencollective.com/nest#sponsor)--> | ||
|
|
||
| ## Description | ||
|
|
||
| [Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. | ||
|
|
||
| ## Installation | ||
|
|
||
| ```bash | ||
| $ npm install | ||
| ``` | ||
|
|
||
| ## Running the app | ||
|
|
||
| ```bash | ||
| # development | ||
| $ npm run start | ||
|
|
||
| # watch mode | ||
| $ npm run start:dev | ||
|
|
||
| # production mode | ||
| $ npm run start:prod | ||
| ``` | ||
|
|
||
| ## Test | ||
|
|
||
| ```bash | ||
| # unit tests | ||
| $ npm run test | ||
|
|
||
| # e2e tests | ||
| $ npm run test:e2e | ||
|
|
||
| # test coverage | ||
| $ npm run test:cov | ||
| ``` | ||
|
|
||
| ## Support | ||
|
|
||
| Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support). | ||
|
|
||
| ## Stay in touch | ||
|
|
||
| - Author - [Kamil Myśliwiec](https://kamilmysliwiec.com) | ||
| - Website - [https://nestjs.com](https://nestjs.com/) | ||
| - Twitter - [@nestframework](https://twitter.com/nestframework) | ||
|
|
||
| ## License | ||
|
|
||
| Nest is [MIT licensed](LICENSE). |
This file contains hidden or 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 @@ | ||
| { | ||
| "$schema": "https://json.schemastore.org/nest-cli", | ||
| "collection": "@nestjs/schematics", | ||
| "sourceRoot": "src" | ||
| } |
This file contains hidden or 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,75 @@ | ||
| { | ||
| "name": "backend", | ||
| "version": "0.0.1", | ||
| "description": "", | ||
| "author": "", | ||
| "private": true, | ||
| "license": "UNLICENSED", | ||
| "scripts": { | ||
| "prebuild": "rimraf dist", | ||
| "build": "nest build", | ||
| "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", | ||
| "start": "nest start", | ||
| "start:dev": "nest start --watch", | ||
| "start:debug": "nest start --debug --watch", | ||
| "start:prod": "node dist/main", | ||
| "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", | ||
| "test": "jest", | ||
| "test:watch": "jest --watch", | ||
| "test:cov": "jest --coverage", | ||
| "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", | ||
| "test:e2e": "jest --config ./test/jest-e2e.json" | ||
| }, | ||
| "dependencies": { | ||
| "@nestjs/common": "^9.0.0", | ||
| "@nestjs/config": "^2.2.0", | ||
| "@nestjs/core": "^9.0.0", | ||
| "@nestjs/platform-express": "^9.0.0", | ||
| "@nestjs/typeorm": "^9.0.1", | ||
| "mysql2": "^2.3.3", | ||
| "reflect-metadata": "^0.1.13", | ||
| "rimraf": "^3.0.2", | ||
| "rxjs": "^7.2.0", | ||
| "typeorm": "^0.3.10" | ||
| }, | ||
| "devDependencies": { | ||
| "@nestjs/cli": "^9.0.0", | ||
| "@nestjs/schematics": "^9.0.0", | ||
| "@nestjs/testing": "^9.0.0", | ||
| "@types/express": "^4.17.13", | ||
| "@types/jest": "28.1.8", | ||
| "@types/node": "^16.0.0", | ||
| "@types/supertest": "^2.0.11", | ||
| "@typescript-eslint/eslint-plugin": "^5.0.0", | ||
| "@typescript-eslint/parser": "^5.0.0", | ||
| "eslint": "^8.0.1", | ||
| "eslint-config-prettier": "^8.3.0", | ||
| "eslint-plugin-prettier": "^4.0.0", | ||
| "jest": "28.1.3", | ||
| "prettier": "^2.3.2", | ||
| "source-map-support": "^0.5.20", | ||
| "supertest": "^6.1.3", | ||
| "ts-jest": "28.0.8", | ||
| "ts-loader": "^9.2.3", | ||
| "ts-node": "^10.0.0", | ||
| "tsconfig-paths": "4.1.0", | ||
| "typescript": "^4.7.4" | ||
| }, | ||
| "jest": { | ||
| "moduleFileExtensions": [ | ||
| "js", | ||
| "json", | ||
| "ts" | ||
| ], | ||
| "rootDir": "src", | ||
| "testRegex": ".*\\.spec\\.ts$", | ||
| "transform": { | ||
| "^.+\\.(t|j)s$": "ts-jest" | ||
| }, | ||
| "collectCoverageFrom": [ | ||
| "**/*.(t|j)s" | ||
| ], | ||
| "coverageDirectory": "../coverage", | ||
| "testEnvironment": "node" | ||
| } | ||
| } |
This file contains hidden or 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,10 @@ | ||
| import { Module } from '@nestjs/common'; | ||
| import { ConfigModule } from '@nestjs/config'; | ||
| import envConfig from './config/env.config'; | ||
|
|
||
| @Module({ | ||
| imports: [ConfigModule.forRoot(envConfig)], | ||
| controllers: [], | ||
| providers: [], | ||
| }) | ||
| export class AppModule {} |
This file contains hidden or 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 @@ | ||
| import { ConfigModuleOptions } from '@nestjs/config'; | ||
|
|
||
| const envConfig: ConfigModuleOptions = { | ||
| isGlobal: true, // 환경 변수를 전역으로 사용 | ||
| envFilePath: '.env', | ||
| // 루트 경로에서 .env 사용 (cross-env로 환경에 따른 .env 적용도 가능) | ||
| }; | ||
|
|
||
| export default envConfig; | ||
This file contains hidden or 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 @@ | ||
| import { NestFactory } from '@nestjs/core'; | ||
| import { AppModule } from './app.module'; | ||
|
|
||
| async function bootstrap() { | ||
| const app = await NestFactory.create(AppModule); | ||
| await app.listen(3000); | ||
| } | ||
| bootstrap(); |
This file contains hidden or 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 @@ | ||
| import { Test, TestingModule } from '@nestjs/testing'; | ||
| import { INestApplication } from '@nestjs/common'; | ||
| import * as request from 'supertest'; | ||
| import { AppModule } from './../src/app.module'; | ||
|
|
||
| describe('AppController (e2e)', () => { | ||
| let app: INestApplication; | ||
|
|
||
| beforeEach(async () => { | ||
| const moduleFixture: TestingModule = await Test.createTestingModule({ | ||
| imports: [AppModule], | ||
| }).compile(); | ||
|
|
||
| app = moduleFixture.createNestApplication(); | ||
| await app.init(); | ||
| }); | ||
|
|
||
| it('/ (GET)', () => { | ||
| return request(app.getHttpServer()) | ||
| .get('/') | ||
| .expect(200) | ||
| .expect('Hello World!'); | ||
| }); | ||
| }); |
This file contains hidden or 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 @@ | ||
| { | ||
| "moduleFileExtensions": ["js", "json", "ts"], | ||
| "rootDir": ".", | ||
| "testEnvironment": "node", | ||
| "testRegex": ".e2e-spec.ts$", | ||
| "transform": { | ||
| "^.+\\.(t|j)s$": "ts-jest" | ||
| } | ||
| } |
This file contains hidden or 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,4 @@ | ||
| { | ||
| "extends": "./tsconfig.json", | ||
| "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] | ||
| } |
This file contains hidden or 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,21 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "module": "commonjs", | ||
| "declaration": true, | ||
| "removeComments": true, | ||
| "emitDecoratorMetadata": true, | ||
| "experimentalDecorators": true, | ||
| "allowSyntheticDefaultImports": true, | ||
| "target": "es2017", | ||
| "sourceMap": true, | ||
| "outDir": "./dist", | ||
| "baseUrl": "./", | ||
| "incremental": true, | ||
| "skipLibCheck": true, | ||
| "strictNullChecks": false, | ||
| "noImplicitAny": false, | ||
| "strictBindCallApply": false, | ||
| "forceConsistentCasingInFileNames": false, | ||
| "noFallthroughCasesInSwitch": false | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
신기한거 알아갑니다 👍👍👍👍