Skip to content

SOPT-31th-App2-Kyobo-Electronic-Libary/Kyobo-SERVER

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

46 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ—ƒ๏ธ Package ๋ฐ config

package.json

{
  "name": "seminar4",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "scripts": {
    "dev": "nodemon",
    "build": "tsc && node dist"
  },
  "devDependencies": {
    "@types/express": "^4.17.14",
    "@types/node": "^18.11.9",
    "nodemon": "^2.0.20"
  },
  "dependencies": {
    "@prisma/client": "^4.6.1",
    "express": "^4.18.2",
    "prisma": "^4.6.1"
  }
}

nodemon.json

{
  "name": "seminar4",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "scripts": {
    "dev": "nodemon",
    "build": "tsc && node dist"
  },
  "devDependencies": {
    "@types/express": "^4.17.14",
    "@types/node": "^18.11.9",
    "nodemon": "^2.0.20"
  },
  "dependencies": {
    "@prisma/client": "^4.6.1",
    "express": "^4.18.2",
    "prisma": "^4.6.1"
  }
}

tsconfig.json

{
  "compilerOptions": {
    "target": "es6", // ์–ด๋–ค ๋ฒ„์ „์œผ๋กœ ์ปดํŒŒ์ผ
    "allowSyntheticDefaultImports": true, // default export๊ฐ€ ์—†๋Š” ๋ชจ๋“ˆ์—์„œ default imports๋ฅผ ํ—ˆ์šฉ
    "experimentalDecorators": true, // decorator ์‹คํ—˜์  ํ—ˆ์šฉ
    "emitDecoratorMetadata": true, // ๋ฐ์ฝ”๋ ˆ์ดํ„ฐ๊ฐ€ ์žˆ๋Š” ์„ ์–ธ์— ๋Œ€ํ•ด ํŠน์ • ํƒ€์ž…์˜ ๋ฉ”ํƒ€ ๋ฐ์ดํ„ฐ๋ฅผ ๋‚ด๋ณด๋‚ด๋Š” ์‹คํ—˜์ ์ธ ์ง€์›
    "skipLibCheck": true, // ์ •์˜ ํŒŒ์ผ ํƒ€์ž… ์ฒดํฌ ์—ฌ๋ถ€
    "moduleResolution": "node", // commonJS -> node ์—์„œ ๋™์ž‘
    "module": "commonjs", // import ๋ฌธ๋ฒ•
    "strict": true, // ํƒ€์ž… ๊ฒ€์‚ฌ ์—„๊ฒฉํ•˜๊ฒŒ 
    "pretty": true, // error ๋ฉ”์‹œ์ง€ ์˜ˆ์˜๊ฒŒ
    "sourceMap": true, // ์†Œ์Šค๋งต ํŒŒ์ผ ์ƒ์„ฑ -> .ts๊ฐ€ .js ํŒŒ์ผ๋กœ ํŠธ๋žœ์Šค ์‹œ .js.map ์ƒ์„ฑ
    "outDir": "./dist", // ํŠธ๋žœ์Šค ํŒŒ์ผ (.js) ์ €์žฅ ๊ฒฝ๋กœ
    "allowJs": true, // js ํŒŒ์ผ ts์—์„œ import ํ—ˆ์šฉ
    "noImplicitAny": true, // any ์“ฐ๋ฉด ์†์ ˆ
    "noFallthroughCasesInSwitch": true, // switch๋ฌธ์—์„œ break๋˜์ง€ ์•Š๊ณ  ํ†ต๊ณผ๋˜๋Š” ๊ฒƒ ๋ฐฉ์ง€
    "esModuleInterop": true, // ES6 ๋ชจ๋“ˆ ์‚ฌ์–‘์„ ์ค€์ˆ˜ํ•˜์—ฌ CommonJS ๋ชจ๋“ˆ์„ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ๊ฒŒ ํ—ˆ์šฉ
    "forceConsistentCasingInFileNames": true, //  ํŒŒ์ผ ์ฐธ์กฐ์‹œ ๋Œ€์†Œ๋ฌธ์ž ๊ตฌ๋ถ„ ์—„๊ฒฉ
    "noUnusedLocals": true,                     // ์•ˆ์“ฐ๋Š” ๋กœ์ปฌ ๋ณ€์ˆ˜ ์ฒดํฌ
    "noUnusedParameters": true,                 // ํ•จ์ˆ˜ ํŒŒ๋ผ๋ฏธํ„ฐ ์ค‘ ์•ˆ์“ฐ๋Š” ๊ฒƒ ์ฒดํฌ
    "typeRoots": [
      "./src/types/express.d.ts", // ํƒ€์ž…(*.d.ts)ํŒŒ์ผ์„ ๊ฐ€์ ธ์˜ฌ ๋””๋ ‰ํ† ๋ฆฌ ์„ค์ •
      "./node_modules/@types" // ์„ค์ • ์•ˆํ• ์‹œ ๊ธฐ๋ณธ์ ์œผ๋กœ ./node_modules/@types
    ]
  },
  "include": [
    "./src/**/*" // build ์‹œ ํฌํ•จ
  ],
  "exclude": [
    "node_modules", // build ์‹œ ์ œ์™ธ
    "tests"
  ]
}

๐Ÿ—จ๏ธ ์ปจ๋ฒค์…˜

๐Ÿ’ก ๋™๋ฃŒ๋“ค๊ณผ ๋งํˆฌ๋ฅผ ํ†ต์ผํ•˜๊ธฐ ์œ„ํ•ด ์ปจ๋ฒค์…˜์„ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. ์˜คํ•ฉ์ง€์กธ์˜ ์ฝ”๋“œ๊ฐ€ ์•„๋‹Œ, ํ•œ ์‚ฌ๋žŒ์ด ์ง  ๊ฒƒ๊ฐ™์€ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜๋Š” ๊ฒƒ์ด ์ถ”ํ›„ ์œ ์ง€๋ณด์ˆ˜๋‚˜ ํ˜‘์—…์—์„œ ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค. ๋‚ด๊ฐ€ ์ฝ”๋“œ๋ฅผ ์ƒ๊ฐํ•˜๋ฉด์„œ ์งค ์ˆ˜ ์žˆ๋„๋ก ํ•ด์ฃผ๋Š” ๋ฃฐ์ด๋ผ๊ณ  ์ƒ๊ฐํ•ด๋„ ์ข‹์Šต๋‹ˆ๋‹ค!

๋ช…๋ช…๊ทœ์น™(Naming Conventions)
  1. ์ด๋ฆ„์œผ๋กœ๋ถ€ํ„ฐ ์˜๋„๊ฐ€ ์ฝํ˜€์งˆ ์ˆ˜ ์žˆ๊ฒŒ ์“ด๋‹ค.
  • ex)

    // bad
    function q() {
      // ...stuff...
    }
    
    // good
    function query() {
      // ..stuff..
    }
  1. ์˜ค๋ธŒ์ ํŠธ, ํ•จ์ˆ˜, ๊ทธ๋ฆฌ๊ณ  ์ธ์Šคํ„ด์Šค์—๋Š” camelCase๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.
  • ex)

    // bad
    const OBJEcttsssss = {};
    const this_is_my_object = {};
    function c() {}
    
    // good
    const thisIsMyObject = {};
    function thisIsMyFunction() {}
  1. ํด๋ž˜์Šค๋‚˜ constructor์—๋Š” PascalCase๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.
  • ex)

    // bad
    function user(options) {
      this.name = options.name;
    }
    
    const bad = new user({
      name: 'nope',
    });
    
    // good
    class User {
      constructor(options) {
        this.name = options.name;
      }
    }
    
    const good = new User({
      name: 'yup',
    });
  1. ํ•จ์ˆ˜ ์ด๋ฆ„์€ ๋™์‚ฌ + ๋ช…์‚ฌ ํ˜•ํƒœ๋กœ ์ž‘์„ฑํ•œ๋‹ค. ex) postUserInformation( )
  2. ์•ฝ์–ด ์‚ฌ์šฉ์€ ์ตœ๋Œ€ํ•œ ์ง€์–‘ํ•œ๋‹ค.
  3. ์ด๋ฆ„์— ๋„ค ๋‹จ์–ด ์ด์ƒ์ด ๋“ค์–ด๊ฐ€๋ฉด ํŒ€์›๊ณผ ์ƒ์˜๋ฅผ ๊ฑฐ์นœ ํ›„ ์‚ฌ์šฉํ•œ๋‹ค
๋ธ”๋ก(Blocks)
  1. ๋ณต์ˆ˜ํ–‰์˜ ๋ธ”๋ก์—๋Š” ์ค‘๊ด„ํ˜ธ({})๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.
  • ex)

    // bad
    if (test)
      return false;
    
    // good
    if (test) return false;
    
    // good
    if (test) {
      return false;
    }
    
    // bad
    function() { return false; }
    
    // good
    function() {
      return false;
    }
  1. ๋ณต์ˆ˜ํ–‰ ๋ธ”๋ก์˜ if ์™€ else ๋ฅผ ์ด์šฉํ•˜๋Š” ๊ฒฝ์šฐ else ๋Š” if ๋ธ”๋ก ๋์˜ ์ค‘๊ด„ํ˜ธ( } )์™€ ๊ฐ™์€ ํ–‰์— ์œ„์น˜์‹œํ‚จ๋‹ค.
  • ex)

    // bad
    if (test) {
      thing1();
      thing2();
    } 
    else {
      thing3();
    }
    
    // good
    if (test) {
      thing1();
      thing2();
    } else {
      thing3();
    }
์ฝ”๋ฉ˜ํŠธ(Comments)
  1. ๋ณต์ˆ˜ํ˜•์˜ ์ฝ”๋ฉ˜ํŠธ๋Š” /** ... */ ๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.
  • ex)

    // good
    /**
     * @param {String} tag
     * @return {Element} element
     */
    function make(tag) {
      // ...stuff...
    
      return element;
    }
  1. ๋‹จ์ผ ํ–‰์˜ ์ฝ”๋ฉ˜ํŠธ์—๋Š” // ์„ ์‚ฌ์šฉํ•˜๊ณ  ์ฝ”๋ฉ˜ํŠธ๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ  ์‹ถ์€ ์ฝ”๋“œ์˜ ์ƒ๋ถ€์— ๋ฐฐ์น˜ํ•œ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์ฝ”๋ฉ˜ํŠธ์˜ ์•ž์— ๋นˆ ํ–‰์„ ๋„ฃ๋Š”๋‹ค.
  • ex)

    // bad
    const active = true; // is current tab
    
    // good
    // is current tab
    const active = true;
    
    // good
    function getType() {
      console.log('fetching type...');
    
      // set the default type to 'no type'
      const type = this._type || 'no type';
    
      return type;
    }
๋ฌธ์ž์—ด(Strings)
  1. ๋ฌธ์ž์—ด์—๋Š” ์‹ฑํฌ์ฟผํŠธ '' ๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.
  • ex)

    // bad
    const name = "Capt. Janeway";
    
    // good
    const name = 'Capt. Janeway';
  1. ํ”„๋กœ๊ทธ๋žจ์—์„œ ๋ฌธ์ž์—ด์„ ์ƒ์„ฑํ•˜๋Š” ๊ฒฝ์šฐ๋Š” ๋ฌธ์ž์—ด ์—ฐ๊ฒฐ์ด ์•„๋‹Œ template strings๋ฅผ ์ด์šฉํ•œ๋‹ค.
  • ex)

    // bad
    function sayHi(name) {
      return 'How are you, ' + name + '?';
    }
    
    // bad
    function sayHi(name) {
      return ['How are you, ', name, '?'].join();
    }
    
    // good
    function sayHi(name) {
      return `How are you, ${name}?`;
    }
ํ•จ์ˆ˜(Functions)
  1. ํ™”์‚ดํ‘œ ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.
  • ex)

     var arr1 = [1, 2, 3];
      var pow1 = arr.map(function (x) { // ES5 Not Good
        return x * x;
      });
    
      const arr2 = [1, 2, 3];
      const pow2 = arr.map(x => x * x); // ES6 Good
์กฐ๊ฑด์‹๊ณผ ๋“ฑ๊ฐ€์‹(Comparison Operators & Equality)
  1. == ์ด๋‚˜ != ๋ณด๋‹ค === ์™€ !== ์„ ์‚ฌ์šฉํ•œ๋‹ค.
  2. ๋‹จ์ถ•ํ˜•์„ ์‚ฌ์šฉํ•œ๋‹ค.
  • ex)

    // bad
    if (name !== '') {
      // ...stuff...
    }
    
    // good
    if (name) {
      // ...stuff...
    }
  1. ๋น„๋™๊ธฐ ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•  ๋•Œ Promiseํ•จ์ˆ˜์˜ ์‚ฌ์šฉ์€ ์ง€์–‘ํ•˜๊ณ  async, await๋ฅผ ์“ฐ๋„๋ก ํ•œ๋‹ค


๐Ÿงณ Branch

๐ŸŒฑ git branch ์ „๋žต

main branch : ๋ฐฐํฌ ๋‹จ์œ„ branch

develop branch : ์ฃผ์š” ๊ฐœ๋ฐœ branch, main merge ์ „ ๊ฑฐ์น˜๋Š” branch

feature branch: ๊ฐ์ž ๊ฐœ๋ฐœ branch

  • ํ•  ์ผ issue ๋“ฑ๋ก ํ›„ issue ๋ฒˆํ˜ธ๋กœ branch ์ƒ์„ฑ ํ›„ ์ž‘์—…
    • ex) feature/#issue num
  • ํ•ด๋‹น branch ์ž‘์—… ์™„๋ฃŒ ํ›„ PR ๋ณด๋‚ด๊ธฐ
    • ํ•ญ์ƒ local์—์„œ ์ถฉ๋Œ ํ•ด๊ฒฐ ํ›„ โ†’ remote์— ์˜ฌ๋ฆฌ๊ธฐ
    • reviewer์— ์„œ๋กœ tagํ›„ code-review
    • comment ์ „ merge ๋ถˆ๊ฐ€!

branch ๊ตฌ์กฐ

- main
- develop
- feature
   โ”œโ”€โ”€ #1
   โ””โ”€โ”€ #2


๐Ÿงณ Commit Convention

๐Ÿ‘ป git commit message convention

ex) Feat/#issue num User API ํŒŒ์ผ ์ถ”๊ฐ€

- Chore : ์ฝ”๋“œ ์ˆ˜์ •, ๋‚ด๋ถ€ ํŒŒ์ผ ์ˆ˜์ •
- Feat : ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ ๊ตฌํ˜„
- Add : Feat ์ด์™ธ์˜ ๋ถ€์ˆ˜์ ์ธ ์ฝ”๋“œ ์ถ”๊ฐ€, ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ถ”๊ฐ€, ์ƒˆ๋กœ์šด ํŒŒ์ผ ์ƒ์„ฑ ์‹œ
- Fix : ๋ฒ„๊ทธ, ์˜ค๋ฅ˜ ํ•ด๊ฒฐ
- Del : ์“ธ๋ชจ์—†๋Š” ์ฝ”๋“œ ์‚ญ์ œ
- Docs : README๋‚˜ WIKI ๋“ฑ์˜ ๋ฌธ์„œ ๊ฐœ์ •
- Move : ํ”„๋กœ์ ํŠธ ๋‚ด ํŒŒ์ผ์ด๋‚˜ ์ฝ”๋“œ์˜ ์ด๋™
- Rename : ํŒŒ์ผ ์ด๋ฆ„์˜ ๋ณ€๊ฒฝ
- Merge: ๋‹ค๋ฅธ๋ธŒ๋ Œ์น˜๋ฅผ mergeํ•˜๋Š” ๊ฒฝ์šฐ
- Style : ์ฝ”๋“œ๊ฐ€ ์•„๋‹Œ ์Šคํƒ€์ผ ๋ณ€๊ฒฝ์„ ํ•˜๋Š” ๊ฒฝ์šฐ
- Init : Initial commit์„ ํ•˜๋Š” ๊ฒฝ์šฐ

๐Ÿ“‹ ERD

image

๐Ÿ“‹ API ๋ช…์„ธ์„œ

๋…ธ์…˜์—์„œ ๋ณด๊ธฐ

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published