Skip to content

๐Ÿ„๐Ÿปโ€โ™‚๏ธ ์šฐ๋ฆฐ ์•ฑ์žผ๋•Œ ๋‹ค ํ•˜๊ณ  ๋ฆด๋ฆฌ์ฆˆ๋•Œ ๋†€์ž

Notifications You must be signed in to change notification settings

seu11ee/CA-PIN_Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

All Contributors

CAPIN-ppt


Project

์˜ค๋Š˜๋„ '์นดํŽ˜ ์–ด๋””๊ฐ€์ง€?' ๊ณ ๋ฏผํ•˜๋Š” ๋ถ„๋“ค์„ ์œ„ํ•œ ์นดํŽ˜๋งต ์•ฑ ์„œ๋น„์Šค / Service OPR

Team-CA:PIN Server
SOPT 28th APPJAM
ํ”„๋กœ์ ํŠธ ๊ธฐ๊ฐ„: 2021.06.26 ~ 2021.07.16


CA:PIN Server Developers / Our CAFETI


CXVB
seu11ee

๐Ÿ’ป

NJMB
snowedev

๐Ÿ’ป

We used

TypeScript ts-node aws mongoose


Dependencies module (package.json)

Dev module:

  "devDependencies": {
    "@types/bcryptjs": "^2.4.2",
    "@types/express": "^4.17.11",
    "@types/mongoose": "^5.10.4",
    "@types/node": "^14.14.37",
    "nodemon": "^2.0.7",
    "ts-node": "^9.1.1",
    "typescript": "^4.2.3"
  }

module:

  "dependencies": {
    "bcryptjs": "^2.4.3",
    "dotenv": "^8.2.0",
    "express": "^4.17.1",
    "express-validator": "^6.10.0",
    "jsonwebtoken": "^8.5.1",
    "mongoose": "^5.12.3",
    "request": "^2.88.2"
  }

Server Architecture


API doc / Task

CA:PIN API Documents


Coding Convention

Coding Convention ์ž์„ธํžˆ ๋ณด๊ธฐ

๋‹ค์Œ ์Šคํƒ€์ผ Guide๋ฅผ ์ฐธ๊ณ ํ—€์Šต๋‹ˆ๋‹ค. ๐Ÿ‘‰๐ŸปAirbnb Style Guide

๐Ÿ—‚ ํด๋”๊ตฌ์กฐ

src
โ”‚   index.ts        # App entry point
โ””โ”€โ”€โ”€api             # Express route controllers for all the endpoints of the app
โ””โ”€โ”€โ”€config          # Environment variables and configuration related stuff
โ””โ”€โ”€โ”€interfaces      # All the interfaces is here
โ””โ”€โ”€โ”€loaders         # Split the startup process into modules
โ””โ”€โ”€โ”€middleware      # auth.ts
โ””โ”€โ”€โ”€models          # Database models
โ””โ”€โ”€โ”€services        # All the business logic is here

๐Ÿ–‹ ๋„ค์ด๋ฐ

  • ๋ณ€์ˆ˜, ํ•จ์ˆ˜, ์ธ์Šคํ„ด์Šค๋Š” *Camel Case(=lower ์นด๋ฉœ ์ผ€์ด์Šค)*๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.

    ex) camelCase

  • ํ•จ์ˆ˜์˜ ๊ฒฝ์šฐ ๋™์‚ฌ+๋ช…์‚ฌ ํ˜•ํƒœ๋กœ ๊ตฌ์„ฑํ•œ๋‹ค.

    ex) getUserInfomation()

  • Class, Contructor๋Š” *Pascal Case(=upper ์นด๋ฉœ ์ผ€์ด์Šค)*๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.

    ex) CamelCase

  • ๊ธ€์ž์˜ ๊ธธ์ด

    • ๊ธ€์ž์˜ ๊ธธ์ด๋Š” 20์ž ์ด๋‚ด๋กœ ์ œํ•œํ•œ๋‹ค.
    • 4๋‹จ์–ด ์ด์ƒ์ด ๋“ค์–ด๊ฐ€๊ฑฐ๋‚˜, ๋ถ€๋“์ดํ•˜๊ฒŒ 20์ž ์ด์ƒ์ด ๋˜๋Š” ๊ฒฝ์šฐ ํŒ€์›๊ณผ์˜ ์ƒ์˜๋ฅผ ๊ฑฐ์นœ๋‹ค.
  • flag๋กœ ์‚ฌ์šฉ๋˜๋Š” ๋ณ€์ˆ˜

    • Boolean์˜ ๊ฒฝ์šฐ ์กฐ๋™์‚ฌ+flag ์ข…๋ฅ˜๋กœ ๊ตฌ์„ฑ๋œ๋‹ค. ex) isNum, hasNum
  • ์•ฝ์นญ์˜ ์‚ฌ์šฉ

    • ์•ฝ์–ด๋Š” ๋˜๋„๋ก ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š”๋‹ค.
    • ๋ถ€๋“์ดํ•˜๊ฒŒ ์•ฝ์–ด๊ฐ€ ํ•„์š”ํ•˜๋‹ค๊ณ  ํŒ๋‹จ๋˜๋Š” ๊ฒฝ์šฐ ํŒ€์›๊ณผ์˜ ์ƒ์˜๋ฅผ ๊ฑฐ์นœ๋‹ค.
      let idx; // bad
      let index; // good
      
      let cnt; // bad
      let count; // good
      
      let arr; // bad
      let array; // good
      
      let seoul2Bucheon; // bad
      let seoulToBucheon; // good

๐Ÿท ์ฃผ์„

ํ•œ์ค„์€ //๋กœ ์ ๊ณ , ๊ทธ ์ด์ƒ์€ /** */๋กœ ์ ๋Š”๋‹ค.

// ํ•œ์ค„ ์ฃผ์„์ผ ๋•Œ
/**
 * ์—ฌ๋Ÿฌ์ค„
 * ์ฃผ์„์ผ ๋•Œ
 */

ํ•จ์ˆ˜์— ๋Œ€ํ•œ ์ฃผ์„

  • backend์—์„œ ๊ณตํ†ต์ ์œผ๋กœ ์‚ฌ์šฉํ•˜๋Š” ํ•จ์ˆ˜์˜ ๊ฒฝ์šฐ, ๋ชจ๋“ˆํ™”๋ฅผ ํ†ตํ•ด ํ•˜๋‚˜์˜ ํŒŒ์ผ๋กœ ๊ด€๋ฆฌํ•œ๋‹ค.
  • ํ•˜๋‚˜์˜ ํŒŒ์ผ์˜ ์‹œ์ž‘ ๋ถ€๋ถ„์— ์ฃผ์„์œผ๋กœ ์ƒ์„ธ ๋‚ด์šฉ์„ ์ž‘์„ฑํ•œ๋‹ค.
    • ํ•จ์ˆ˜์˜ ์ „์ฒด ๊ธฐ๋Šฅ์— ๋Œ€ํ•œ ์„ค๋ช…
    • ํ•จ์ˆ˜์˜ ํŒŒ๋ผ๋ฏธํ„ฐ์— ๋Œ€ํ•œ ์„ค๋ช… (type: ..., ์—ญํ• )
    • router ๋˜๋Š” api์ผ ๋•Œ์—๋Š” ์„ฑ๊ณต ์—ฌ๋ถ€๋„ ์ ์–ด์ค€๋‹ค.
    • ์˜ˆ์‹œ ์ฝ”๋“œ
      /**
       * @api {get} /study/:roomNumber/questions?sort_by=created&order_by=asc ๋ฐฉ์˜ ์งˆ๋ฌธ ๋ชฉ๋ก์„ ๊ฐ€์ ธ์˜ด
      * @apiName GetQuestions
      * @apiGroup Question
      *
      * @apiParam {String} roomNumber ์œ ์ผํ•œ ๋ฐฉ ๋ฒˆํ˜ธ
      *
      * @apiSuccess {Boolean} success API ํ˜ธ์ถœ ์„ฑ๊ณต ์—ฌ๋ถ€
      * @apiSuccess {String} message ์‘๋‹ต ๋ฉ”์‹œ์ง€
      * @apiSuccess {Object} data ํ•ด๋‹น ๋ฐฉ์˜ ์งˆ๋ฌธ ๋ฆฌ์ŠคํŠธ
      */
      router.get(
      "/study/:roomNumber/questions",
      [checkParamAndQuery("roomNumber").isNumeric()],
      getQuestions.default
      );

Commit Messge Rules

โœ‰๏ธ CA:PIN Server Git Commit Message Rules

๐Ÿ“œ ์ปค๋ฐ‹ ๋ฉ”์‹œ์ง€ ๋ช…๋ น์–ด ๋ชจ์Œ

๋ฐ˜์˜์‚ฌํ•ญ์„ ๋ฐ”๋กœ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋„๋ก ์ž‘์€ ๊ธฐ๋Šฅ ํ•˜๋‚˜๋ผ๋„ ๊ตฌํ˜„๋˜๋ฉด ์ปค๋ฐ‹์„ ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค.

  - init : ์ดˆ๊ธฐํ™”
  - feat : ๊ธฐ๋Šฅ ์ถ”๊ฐ€
  - update : ๊ธฐ๋Šฅ ๋ณด์™„ (์—…๊ทธ๋ ˆ์ด๋“œ)
  - fix : ๋ฒ„๊ทธ ์ˆ˜์ •
  - refactor: ๋ฆฌํŒฉํ† ๋ง
  - style : ์Šคํƒ€์ผ (์ฝ”๋“œ ํ˜•์‹, ์„ธ๋ฏธ์ฝœ๋ก  ์ถ”๊ฐ€: ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง์— ๋ณ€๊ฒฝ ์—†์Œ)
  - docs : ๋ฌธ์„œ (๋ฌธ์„œ ์ถ”๊ฐ€(Add), ์ˆ˜์ •, ์‚ญ์ œ)
  - test : ํ…Œ์ŠคํŠธ (ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ถ”๊ฐ€, ์ˆ˜์ •, ์‚ญ์ œ: ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง์— ๋ณ€๊ฒฝ ์—†์Œ)
  - chore : ๊ธฐํƒ€ ๋ณ€๊ฒฝ์‚ฌํ•ญ (๋นŒ๋“œ ์Šคํฌ๋ฆฝํŠธ ์ˆ˜์ •, ์—์…‹ ์ถ”๊ฐ€ ๋“ฑ)

โ„น๏ธ ์ปค๋ฐ‹ ๋ฉ”์„ธ์ง€ ํ˜•์‹

  • [์ปค๋ฐ‹๋ฉ”์„ธ์ง€] ์„ค๋ช… ํ˜•์‹์œผ๋กœ ์ปค๋ฐ‹ ๋ฉ”์‹œ์ง€๋ฅผ ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค.
  • ์ปค๋ฐ‹ ๋ฉ”์‹œ์ง€๋Š” ์˜์–ด ์‚ฌ์šฉ์„ ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค.
    [feat] add user model
    

Github mangement

๐Ÿ’ป CA:PIN Server Branch Strategy

๋ธŒ๋žœ์น˜ ์ „๋žต

  • main ๋ธŒ๋žœ์น˜ - ํ”„๋กœ์ ํŠธ ์ดˆ๊ธฐ ์…‹ํŒ…
  • dev ๋ธŒ๋žœ์น˜ - default branch๋กœ ์„ค์ •
  • ํ•  ์ผ issue ๋“ฑ๋ก ํ›„ issue ๋ฒˆํ˜ธ๋กœ ๋ธŒ๋žœ์น˜ ์ƒ์„ฑ ํ›„ ์ž‘์—…
    • feature/#์ด์Šˆ๋„˜๋ฒ„
  • PR โžก๏ธ ์ฝ”๋“œ๋ฆฌ๋ทฐ โžก๏ธ ๋จธ์ง€( โ†’ dev)
  • ๋จธ์ง€ ํ›„ feature ๋ธŒ๋žœ์น˜ ์‚ญ์ œ
  • ๋ธŒ๋žœ์น˜ ์ƒ์„ฑ ์ „ dev ์ตœ์‹ ํ™”
  • PR ์ „ tsc or yarn run build๋กœ dist ์—…๋ฐ์ดํŠธ ํ›„ ์ปค๋ฐ‹

- main
- dev
- feature
   โ”œโ”€โ”€ #1
   โ”œโ”€โ”€ #2
   โ””โ”€โ”€ #3


About

๐Ÿ„๐Ÿปโ€โ™‚๏ธ ์šฐ๋ฆฐ ์•ฑ์žผ๋•Œ ๋‹ค ํ•˜๊ณ  ๋ฆด๋ฆฌ์ฆˆ๋•Œ ๋†€์ž

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published