โ ํ ์ผ
-S3 ์ด๋ฏธ์ง ๋ถ๋ฌ์ค๊ธฐ ์๋ฌ ํด๊ฒฐ - ํผ๋ธ๋ฆญ ์ค์
-๋ง์ดํ์ด์ง ํ๋ก ํธ ์์ , ๋ฐฑ์๋ api ์ฐ๊ฒฐ ์
-๋ด ์ ๋ณด ์กฐํ api queryBuilder๋ก ์ ๋ ํธ ๋ณ๊ฒฝ
โ๏ธ ๊ธฐ๋ก
๋ชฉ์ฐจ
[S3 ์ด๋ฏธ์ง ๋ถ๋ฌ์ค๊ธฐ-ํผ๋ธ๋ฆญ ์ค์ ]
[app.controller.ts์์ ๋ค๋ฅธ ๋ชจ๋์ service ๋ถ๋ฌ์ฌ๋]
[S3 ์ด๋ฏธ์ง ๋ถ๋ฌ์ค๊ธฐ-ํผ๋ธ๋ฆญ ์ค์ ]
S3 ๋ฐ์ดํฐ์ ์ ์ฅ๋ URL์ ์ ๊ทผํ๋ ค๋ฉด ์๋ ์ค๋ฅ ๋ฐ์, ๊ถํ์ด ์์ด์ ๊ทธ๋ ๋ค.
This XML file does not appear to have any style information associated with it. The document tree is shown below.
ํด๊ฒฐ์ฑ => AWS S3 ๋ฒํท์ ์ฑ ์ค์ ์ด ํ์ํจ.
1. S3 ๋ฒํท ์ ๊ทผ์ด ์๋ IAM ์์ฑ ํ ์ ์ฑ ์ค์
2. aws accesskey IAM ๊ณ์ ์ผ๋ก .env์ ์ ์ฅ
3. ๋ฒํท์ ํด๋๋ฅผ ALC ํผ๋ธ๋ฆญ์ผ๋ก ์ง์ ์ค์ ํด์ค์ผ ํจ.
[app.controller.ts์์ ๋ค๋ฅธ ๋ชจ๋์ service ๋ถ๋ฌ์ฌ๋]
// users.modules.ts (๋ด๋ณด๋ผ ๋ชจ๋)
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { MulterModule } from '@nestjs/platform-express';
import { UserService } from './users.service';
import { UserController } from './users.controller';
import { UsersEntity } from '../common/entities/users.entity';
import { UploadsService } from 'src/uploads/uploads.service';
import * as multer from 'multer';
@Module({
imports: [
MulterModule.register({
storage: multer.memoryStorage(), // ๋ฉ๋ชจ๋ฆฌ ์คํ ๋ฆฌ์ง์ ์์๋ก ์ ์ฅํ S3์ ์
๋ก๋
}),
TypeOrmModule.forFeature([UsersEntity]),
],
controllers: [UserController],
providers: [UserService, UploadsService],
exports: [UserService],
})
export class UsersModule {}
// app.controller.ts - ๋ฐ๋๊ณณ์ ๋น์ฐํ ์ฃผ์ ํด์ ์ฌ์ฉ
constructor(private readonly userService: UserService) {}