[32st SOPT APPJAM] Server team repository of Runnect
μ½μ€ κ·Έλ¦¬κΈ°λ‘ λ¬λ¦¬κΈ° μ λͺ©νλ₯Ό μ€μ νκ³ μ€μκ° νΈλνΉμΌλ‘ μ½μ€λ₯΄ λ°λΌ μ λ¬λ¦¬κ³ μλμ§ νμΈν©λλ€.
μ½μ€ λ°κ²¬μ ν΅ν΄ λμκ² λ§λ μ½μ€λ₯Ό μΆμ² λ°κ±°λ λ€λ₯Έ μ μ κ° κ³΅μ ν μ½μ€λ₯Ό κ²μνκ³ μ€ν¬λ©ν©λλ€. μ½μ€λ₯Ό μ§μ μ λ‘λν μ λ μμ΅λλ€.
μ½μ€ 보κ΄ν¨μμ λ΄κ° κ·Έλ¦° μ½μ€μ μ€ν¬λ© μ½μ€λ₯Ό κ΄λ¦¬ν©λλ€.
λ§μ΄νμ΄μ§μμ νλ‘νκ³Ό νλ κΈ°λ‘, μ λ‘λν μ½μ€λ₯Ό νμΈνκ³ λͺ©ν 보μμΌλ‘ λκΈ°λ₯Ό κ°νν©λλ€.
{
"name": "Runnect_Server",
"version": "1.0.0",
"main": "index.js",
"repository": "https://github.com/Runnect/Runnect_Server.git",
"author": "YuSuhwa-ve <dhfhfkzjxms@sookmyung.ac.kr>",
"license": "MIT",
"scripts": {
"dev": "nodemon",
"build": "tsc && node dist",
"db:pull": "npx prisma db pull",
"db:push": "npx prisma db push",
"generate": "npx prisma generate",
"prepare": "chmod ug+x .husky/* && husky install",
"greet": "hello husky!",
"test": "mocha ./test/ -r ts-node/register"
},
"dependencies": {
"@prisma/client": "^4.8.0",
"aws-sdk": "^2.1281.0",
"bcryptjs": "^2.4.3",
"dayjs": "^1.11.7",
"dotenv": "^16.0.3",
"express": "^4.18.2",
"express-validator": "^6.14.2",
"jsonwebtoken": "^9.0.0",
"multer": "^1.4.5-lts.1",
"multer-s3": "^3.0.1",
"prisma": "^4.8.0"
},
"devDependencies": {
"@types/bcryptjs": "^2.4.2",
"@types/chai": "^4.3.4",
"@types/express": "^4.17.15",
"@types/express-validator": "^3.0.0",
"@types/jsonwebtoken": "^8.5.9",
"@types/mocha": "^10.0.1",
"@types/multer": "^1.4.7",
"@types/multer-s3": "^3.0.0",
"@types/node": "^18.11.17",
"@types/supertest": "^2.0.12",
"chai": "^4.3.7",
"commitizen": "^4.2.6",
"cz-conventional-changelog": "3.3.0",
"cz-emoji-conventional": "^1.0.1",
"husky": "^8.0.0",
"mocha": "^10.2.0",
"nodemon": "^2.0.20",
"supertest": "^6.3.3",
"ts-node": "^10.9.1",
"typescript": "^4.9.4"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-emoji-conventional"
}
}
}
π src
|_ π config
|_ π constant
|_ π controller
|_ π interface
|_ π middleware
|_ π module
|_ π prisma
|_ π router
|_ π service
|_ index.ts
π test
λ΄λΉμ | λ΄λΉ λ΄μ© | ꡬν μ§μ²λ |
---|---|---|
μ μν | EC2, publicCourse & stamp κ΄λ ¨ api | 100% |
μ μ ν¬ | RDS, course & user κ΄λ ¨ api | 100% |
λ°μλ¦° | S3, record & scrap κ΄λ ¨ api | 100% |
π‘ λλ£λ€κ³Ό λ§ν¬λ₯Ό ν΅μΌνκΈ° μν΄ μ»¨λ²€μ μ μ§μ ν©λλ€. μ€ν©μ§μ‘Έμ μ½λκ° μλ, ν μ¬λμ΄ μ§ κ²κ°μ μ½λλ₯Ό μμ±νλ κ²μ΄ μΆν μ μ§λ³΄μλ νμ μμ λμμ΄ λ©λλ€. λ΄κ° μ½λλ₯Ό μκ°νλ©΄μ 지 μ μλλ‘ ν΄μ£Όλ λ£°μ΄λΌκ³ μκ°ν΄λ μ’μ΅λλ€!
λͺ λͺ κ·μΉ(Naming Conventions)
- μ΄λ¦μΌλ‘λΆν° μλκ° μ½νμ§ μ μκ² μ΄λ€.
-
ex)
// bad function q() { // ...stuff... } // good function query() { // ..stuff.. }
- μ€λΈμ νΈ, ν¨μ, κ·Έλ¦¬κ³ μΈμ€ν΄μ€μλ
camelCase
λ₯Ό μ¬μ©νλ€.
-
ex)
// bad const OBJEcttsssss = {}; const this_is_my_object = {}; function c() {} // good const thisIsMyObject = {}; function thisIsMyFunction() {}
- ν΄λμ€λ 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", });
- ν¨μ μ΄λ¦μ λμ¬ + λͺ
μ¬ ννλ‘ μμ±νλ€.
ex)
postUserInformation( )
- μ½μ΄ μ¬μ©μ μ΅λν μ§μνλ€.
- μ΄λ¦μ λ€ λ¨μ΄ μ΄μμ΄ λ€μ΄κ°λ©΄ νμκ³Ό μμλ₯Ό κ±°μΉ ν μ¬μ©νλ€
λΈλ‘(Blocks)
- 볡μνμ λΈλ‘μλ μ€κ΄νΈ({})λ₯Ό μ¬μ©νλ€.
-
ex)
// bad if (test) return false; // good if (test) return false; // good if (test) { return false; } // bad function() { return false; } // good function() { return false; }
- 볡μν λΈλ‘μ
if
μelse
λ₯Ό μ΄μ©νλ κ²½μ°else
λif
λΈλ‘ λμ μ€κ΄νΈ( } )μ κ°μ νμ μμΉμν¨λ€.
- ex)
java // bad if (test) { thing1(); thing2(); } else { thing3(); } // good if (test) { thing1(); thing2(); } else { thing3(); }
μ½λ©νΈ(Comments)
- 볡μνμ μ½λ©νΈλ
/** ... */
λ₯Ό μ¬μ©νλ€.
-
ex)
// good /** * @param {String} tag * @return {Element} element */ function make(tag) { // ...stuff... return element; }
- λ¨μΌ νμ μ½λ©νΈμλ
//
μ μ¬μ©νκ³ μ½λ©νΈλ₯Ό μΆκ°νκ³ μΆμ μ½λμ μλΆμ λ°°μΉνλ€. κ·Έλ¦¬κ³ μ½λ©νΈμ μμ λΉ νμ λ£λλ€.
- ex)
jsx // 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)
- λ¬Έμμ΄μλ μ±ν¬μΏΌνΈ
''
λ₯Ό μ¬μ©νλ€.
-
ex)
// bad const name = "Capt. Janeway"; // good const name = "Capt. Janeway";
- νλ‘κ·Έλ¨μμ λ¬Έμμ΄μ μμ±νλ κ²½μ°λ λ¬Έμμ΄ μ°κ²°μ΄ μλ
template strings
λ₯Ό μ΄μ©νλ€.
- ex)
jsx // 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)
- νμ΄ν ν¨μλ₯Ό μ¬μ©νλ€.
-
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)
==
μ΄λ!=
보λ€===
μ!==
μ μ¬μ©νλ€.- λ¨μΆνμ μ¬μ©νλ€.
-
ex)
// bad if (name !== "") { // ...stuff... } // good if (name) { // ...stuff... }
- λΉλκΈ° ν¨μλ₯Ό μ¬μ©ν λ
Promise
ν¨μμ μ¬μ©μ μ§μνκ³async
,await
λ₯Ό μ°λλ‘ νλ€
π± git branch μ λ΅
main branch
: λ°°ν¬ λ¨μ branch
dev branch
: μ£Όμ κ°λ° branch, main merge μ κ±°μΉλ branch
feat branch
: κ°μ κ°λ° branch
- ν μΌ issue λ±λ‘ ν issue λ²νΈμ isuue μ΄λ¦μΌλ‘ branch μμ± ν μμ
- ex) feat/#
issue num
-isuue name(κΈ°λ₯μμ½)
- ex) feat/#
- ν΄λΉ branch μμ
μλ£ ν PR 보λ΄κΈ°
- νμ localμμ μΆ©λ ν΄κ²° ν β remoteμ μ¬λ¦¬κΈ°
- reviewerμ μλ‘ tagν code-review
- comment μ merge λΆκ°!
- reviewλ°μ ν, λ³ΈμΈμ΄ merge.
- main
- dev
- feat
βββ #1-isuue name1
βββ #2-isuue name2
π git commit message convention
ex) feat(λ³κ²½ν νμΌ) : λ³κ²½ λ΄μ© (/#issue num)
- β¨ feat: μλ‘μ΄ κΈ°λ₯ ꡬν
- π fix: λ²κ·Έ, μ€λ₯ ν΄κ²°
- π§Ή chore: src λλ test νμΌμ μμ νμ§ μλ κΈ°ν λ³κ²½ μ¬ν ( μλ‘μ΄ νμΌ μμ±, νμΌ μ΄λ, μ΄λ¦ λ³κ²½ λ± )
- β»οΈ refactor: λ²κ·Έ μμ μ΄λ κΈ°λ₯ μΆκ°κ° μλ μ½λ λ³κ²½ ( μ½λ ꡬ쑰 λ³κ²½ λ±μ 리ν©ν λ§ )
- π style: μ½λμ μλ―Έμ μν₯μ λ―ΈμΉμ§ μλ λ³κ²½ μ¬ν ( μ½λ νμ, μΈλ―Έμ½λ‘ μΆκ°: λΉμ¦λμ€ λ‘μ§μ λ³κ²½ μμ )
- ποΈ build: λΉλ μμ€ν
λλ μΈλΆμ μν₯μ λ―ΈμΉλ λ³κ²½ μ¬ν μ’
μμ± ( λΌμ΄λΈλ¬λ¦¬ μΆκ° λ± )
- π perf: μ±λ₯μ ν₯μ μν€κΈ° μν μ½λ λ³κ²½
- π§ͺ test: ν
μ€νΈ μΆκ° λλ μ΄μ ν
μ€νΈ μμ
- π docs: READMEλ WIKI λ±μ λ¬Έμ κ°μ
- βͺοΈ revert: μ΄μ 컀λ°μ λλ리λ κ²½μ°
- π¦ ci: CI κ΅¬μ± νμΌ λ° μ€ν¬λ¦½νΈ λ³κ²½
- Merge: λ€λ₯ΈλΈλ μΉλ₯Ό mergeνλ κ²½μ°
- Init : Initial commitμ νλ κ²½μ°