[항해99] 79일차
항해 99
79일 차:
✨빛 과같으신 분의 스파르타 입사 소식에 다 같이 축하해드리고 , 수다도 많이 떨었다.
79일 차 중에서 제일 재밌었던 것 같은데....
어제 라이브 먹방을 본뒤로 라면이 머릿속에서 떠나가 질 않는다...
결국 나도 점심으로 라면을 먹었다.
좀 잇다 씻기 전에 40층 계단 타면 되지머... 항아리의 인생은 슬픈 것 같다.
인제 파인애플에서 항아리로 닉네임을 바꿔야 되지 않을까 생각했다.
이거 사야 댄다
멜킨스포츠 실내 자전거 접이식 바이크 MKHB-01 : 네이버 쇼핑
강약조절 : 8단계, 부가기능 : 접이식, 형태 : 입식+좌식형, 무게 : 19kg, 최대하중 : 100kg, 거치기능 : 스마트폰거치
search.shopping.naver.com
1. s3로 나눠서 이미지 저장 및 받아오기
export default class ImageController implements Controller {
public readonly path = '/images'
public readonly router = Router()
constructor() {
this.initializeRoutes()
}
private initializeRoutes() {
this.router.route(this.path).post(authenticate(), imageUpload, this.saveImage)
this.router.route(this.path + '/:key').get(this.getImage)
}
private async saveImage(req: Request, res: Response, next: NextFunction) {
const file = req.file
const result = await uploadFile(file).catch((err) => next(err))
console.log('file :: ', file)
console.log('result :: ', result)
const unlinkFile = util.promisify(fs.unlink)
await unlinkFile(file?.path as fs.PathLike)
return res.status(201).json({ path: `/images/${result?.Key}` })
}
private async getImage(req: Request, res: Response) {
const bucketName = process.env.AWS_BUCKET_NAME
const region = process.env.AWS_BUCKET_REGION
const accessKeyId = process.env.AWS_ACCESS_KEY
const secretAccessKey = process.env.AWS_SECRET_KEY
const key = req.params.key
const s3 = new S3({
region,
accessKeyId,
secretAccessKey
})
const downloadParams = {
Key: key,
Bucket: bucketName as string
}
return s3.getObject(downloadParams, (err, data) => {
res.writeHead(200, { 'Content-Type': 'image/jpeg' })
res.write(data.Body, 'binary')
res.end(null, 'binary')
})
}
}
https://stackoverflow.com/questions/48296569/how-to-retrieve-image-from-s3-with-nodejs/48297282
how to retrieve image from s3 with nodejs
Please let me know how to retrieve image from s3 with nodejs? Honestly, I could upload an image to s3 with nodejs as follows but the problem is how can I complete to retrieve image from s3? router...
stackoverflow.com
2. prisma , RDS랑 연결하기
이게 뭐야 이게 SQL syntax 에러??
RDS를 프리즈마랑 연결하려고 했는데 찾아보니 생각보다 자료가 없었다.
prisma2를 더 많이 쓰는 느낌이다.
생각보다 연결하는 방법은 쉬웠는데.
* RDS 처음 세팅할 때 pubulic access 허가하기
* security group inbound 규칙 정해주기
****************** mySQL 8.0.16으로 설정하기
5.6까지만 지원한다는 것 같은데 5.6이 안돼서 삽질해본 결과 8.0.16 버전은 연결이 됨. ******************
Connect your database
Connect your database to your project
www.prisma.io
- passport 구현에 관한 질문 , 모르는 것 , 배운 것 :
카카오 passport에 관한 카카오 글 :
https://developers.kakao.com/docs/latest/ko/kakaologin/common
Kakao Developers
카카오 API를 활용하여 다양한 어플리케이션을 개발해보세요. 카카오 로그인, 메시지 보내기, 친구 API, 인공지능 API 등을 제공합니다.
developers.kakao.com
https://auth0.com/blog/refresh-tokens-what-are-they-and-when-to-use-them/
What Are Refresh Tokens and How to Use Them Securely
Learn about refresh tokens and how they help developers balance security and usability in their applications.
auth0.com
map filter reduce sort
validator - erroer handling
import { ValidationError } from 'class-validator'
import HttpException from './Http.exception'
export default class ValidationFailureException extends HttpException {
constructor(errors: ValidationError[]) {
const errs = errors
.map((validationError) => validationError.constraints)
.map((constraints) => Object.values(constraints as { [s: string]: string }))
.map((errorArrays) => errorArrays.reduce((acc, curr) => acc.concat(`, ${curr}`)))
.reduce((acc, curr) => acc.concat(`, ${curr}`))
console.log(errors)
super(400, errs)
}
}
파이널 프로젝트도 인제 거의 막바지인 것 같고,
새로운 구현보다는 인제 완성도를 높이고 안에 있는 걸 채워서 서비스 론칭? 을 해야 할 것 같다.
최근.. 거의 이주 동안 코딩은 한 게 별로 없고 그냥 docker , s3 , rds 이런 것만 만지니깐... 재미가 없다.
나도 코딩하고 싶어...
'IT > Bootcamp 항해99' 카테고리의 다른 글
[항해99] 81일차 내일만나요 (4) | 2021.08.26 |
---|---|
[항해99] 80일차 부트캠프 비교 커뮤니티 토크부트 (2) | 2021.08.26 |
[항해99] 78일차 얼마안남앗어 (2) | 2021.08.24 |
[항해99] 76일차 & 77일차 아키텍쳐 , aws (3) | 2021.08.23 |
[항해99] 75일차 함께하는 동료를 의심하자. (8) | 2021.08.21 |