μ€λ¬Έ μ‘°μ¬ μμ± λ° λΆμ νλ‘μΈμ€λ₯Ό λ¨μννμ¬ μ€λ¬Έ μ‘°μ¬ μ μμμ μλ΅μ κ°μ μ°Έμ¬μ νΌλλ°±μ λμΌ μ μλ κ°νΈν μ€λ¬Έ μ‘°μ¬ νλ«νΌμ
λλ€.
κ°λ° κΈ°κ° 2023.03 ~ 2023.05
μ¬μ΄νΈ λ°λ‘κ°κΈ° https://server.acceler.kr/ (π§μ
λ°μ΄νΈ μ€)
Team repo https://github.com/orgs/KEA-ACCELER/repositories
src
βββ common # κ³΅ν΅ μ»΄ν¬λνΈ
β βββ constant
β βββ decorator
β βββ dto
β βββ guard
β βββ pipe
βββ cache # μΊμ λͺ¨λ
βββ batch # batch λͺ¨λ
βββ answer # μλ΅ λͺ¨λ
β βββ controller
β βββ dto
β βββ helper
β βββ pipe
β βββ repository
β βββ service
βββ file # νμΌ λͺ¨λ
β βββ controller
β βββ dto
β βββ helper
β βββ repository
β βββ service
βββ my-page # λ§μ΄νμ΄μ§ λͺ¨λ
β βββ controller
β βββ service
βββ schema # μ€ν€λ§
βββ survey # μ€λ¬Έμ§ λͺ¨λ
βββ controller
βββ dto
βββ helper
βββ pipe
βββ repository
βββ service
- common
- 곡ν΅μ μΌλ‘ μ¬μ©λ νμΌλ‘ ꡬμ±
constant
,decorator
,dto
,guard
,pipe
λ±
- cache
- λ λμ€λ₯Ό μ¬μ©ν κΈ°λ³Έμ μΈ μΊμ± μ²λ¦¬
- batch
- 맀μκ°λ§λ€ μ€μΌμ€λ¬λ₯Ό ν΅ν΄ μκ°λ³ μΈκΈ°κΈ μΊμ± μ²λ¦¬
- schema
- μ€ν€λ§ κ΄λ ¨ νμΌλ‘ ꡬμ±
- answer
- μ€λ¬Έ μλ΅ κ΄λ ¨ νμΌλ‘ ꡬμ±
- file
- νμΌ μ²λ¦¬ κ΄λ ¨ νμΌλ‘ ꡬμ±
- my-page
- λ§μ΄νμ΄μ§ κ΄λ ¨ νμΌλ‘ ꡬμ±
- survey
- μ€λ¬Έ κ΄λ ¨ νμΌλ‘ ꡬμ±
λΉμ¦λμ€ λ‘μ§μ΄ μλ μλΉμ€ κ³μΈ΅κ³Ό λ°μ΄ν°λ² μ΄μ€μ μ κ·Όνλ λ°μ΄ν° μμ€ κ³μΈ΅ μ¬μ΄μ λ ν¬μ§ν 리 κ³μΈ΅μ μμ±ν΄ λ κ³μΈ΅μ μ€κ³
μΊμ± μ λ΅ Look Aside + Write Around
- λ°μ΄ν°λ₯Ό μ°Ύμ λ μ°μ μ μΌλ‘ μΊμμ μλμ§ νμΈνκ³ , μΊμμ λ°μ΄ν°κ° μλ κ²½μ°μλ§ λ°μ΄ν°λ² μ΄μ€(DB)μμ μ‘°ν -> μ΄ν μ‘°νν λ°μ΄ν°λ μΊμμ μ μ₯
μκ°λ³ μΈκΈ° μ€λ¬Έ μΊμ± μ κ°λ§λ€ cron jobμ ν΅ν΄ μκ°λ³ μΈκΈ° μ€λ¬Έ(μ΄μ ν μκ° λμ μ€λ¬Έ μλ΅μ΄ κ°μ₯ λ§μ κ²)μ μΊμ±
@Cron(CronExpression.EVERY_HOUR, {
name: 'popular-survey',
timeZone: 'Asia/Seoul',
})
async cachingPopularSurvey() {
const currentTime = moment().tz('Asia/Seoul').toDate();
const popularSurvey = await this.surveyService.findPopular({
date: currentTime,
type: PopularSurveyResponseType.ID,
});
await this.cacheService.set(
this.keyHelper.getPopularSurveyKey(currentTime),
JSON.stringify(popularSurvey),
);
}
PORT=
# MONGOOSE
DATABASE_URL=
DATABASE_USER=
DATABASE_PASSWORD=
# REDIS
USER_HOSTNAME=
REDIS_HOST=
REDIS_PORT=
# AWS S3
AWS_ENDPOINT=
REGION=
S3_BUCKET_NAME=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
- λ‘컬μμ μ€ν
# ν¨ν€μ§ μ€μΉ
$ npm install
# development, λ°λͺ¨ μ μ¬μ©
$ npm start
# watch mode
$ npm run start:dev
# debug mode
$ npm run start:debug
# production mode
$ npm run start:prod
- λ컀 컨ν μ΄λ μ€ν
docker compose up -d
http://localhost:${PORT}/surveys/api
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov