백엔드를 구현하다보니, 결국 프론트에서 DB까지의 징검다리 역할을 하는 것만 같았다.
그리고 모든 작업은 프론트에서 가능해보였다.
그래서 궁금해졌다.
왜 프론트에서 DB에 직접적으로 접근하지 않을까?
결과부터 말하자면, 전부 가능한 것이었다. 그러나 분리되어야만 하는 이유가 있었다.
- 보안과 관련된 것들이 전부 사용자에게 노출된다.
- 알고리즘이 노출된다.
- DB 역시 노출되어서, 다른 사람들이 마음대로 접근할 수 있다.
- 서버에서 작업들을 분산적으로 처리하지 않고, 브라우저로 한 번에 쏴서 모든 역할을 전가한다면 브라우저의 부담이 엄청나진다. 등등 …
생각해보면 1, 2, 3번은 간단히 생각해봐도 떠올릴 수 있는 것들이었다.
근데 보안을 생각하다보니, 배포할 땐 환경변수를 어떻게 관리하는지 궁금해졌다.
오늘 찾아보고 글 작성해서 링크 걸어야겠다.
Is it possible to directly connect frontend to the database?
Is it possible to directly connect frontend to the database?
I came across this joke the other day. Someone on the internet was asking why do we need a backend, just connect the frontend to the database. It seemed funny at first, but really is it possible to
stackoverflow.com
Why do we need a back-end in web development? Can't the front-end directly send requests to the database?
Answer (1 of 6): While you could theoretically send requests directly from the front-end to the database that’s something of a gross oversimplification. Let’s look at some of the problems: Security is the biggest and it alone should stop the line of th
www.quora.com
'프론트엔드' 카테고리의 다른 글
intersection observer 이해하기 (0) | 2023.07.30 |
---|---|
프론트에서 DFS로 무한 대댓글 구현하기 (0) | 2023.07.28 |
프로젝트 배포할 때는 환경변수 설정을 어떻게 할까? (0) | 2023.07.25 |
React checkbox 관리하기 (0) | 2023.07.24 |
axios + useQuery 똑똑하게 쓰기 (0) | 2023.07.22 |