
๊ธฐ์กด์ ์ํคํ ์ฒ ๊ธฐ์กด์ ์ํคํ ์ฒ๋ Monolitic ์ํคํ ์ฒ๋ก ํ๋์ ์ฝ๋ ๋ฒ ์ด์ค์ ํ๋์ ๋ฐฐํฌ ์ฃผ๊ธฐ๋ฅผ ๊ฐ์ง๊ณ ์๋ ์ํคํ ์ฒ๋ฅผ ๋ปํ๋ค. ์๋น์ค ๋ณ๋ก ๋๋์ด์ ธ์์ง ์์ผ๋ฉฐ ํ๋์ ์๋น์ค๋ฅผ ๊ฐฑ์ ํ์ฌ ๋ฐฐํฌํ๊ณ ์ ํ๋ฉด ๋ชจ๋ ์๋น์ค๊ฐ ๋ค์ ๋ฐฐํฌ ๋๋ค. MSA ์ฅ์ ๊ฐ๋จํ๋ค. ์ ์ง๋ณด์๊ฐ ์ฉ์ดํ๋ค. MSA ๋จ์ ๋น๋ ์๊ฐ, ํ ์คํธ ์๊ฐ, ๋ฐฐํฌ ์๊ฐ์ด ๋น ๋ฅด๊ฒ ์์นํ๋ค. ํ๋์ ์๋น์ค์ ์ฅ์ ๊ฐ ์ ์ฒด ์๋น์ค๋ก ์ด์ด์ง ์ ์๋ค. ์๋น์ค์ ์ํฅ๋๋ ์ ์ฒด ์์คํ ์ ํ์ ์ด ์ด๋ ต๋ค. MSA ๊ตฌ์กฐ UI layer ๋น์ฆ๋์ค ๋ก์ง layer ๋ฐ์ดํฐ ์ ๊ทผ layer DB Micro Service Architecture MSA๋ ๋ฐฐํฌ ๋จ์๋ฅผ ์๋น์ค ๋ณ๋ก ์ชผ๊ฐ ์ํคํ ์ฒ๋ฅผ ๋ปํ๋ค. ๋น๊ตํ์๋ฉด ์์ ๊ทธ๋ฆผ๊ณผ ๊ฐ๋ค. MSA ํน์ง ๊ฐ ์๋น์ค๋ mono..
Refresh token์ ์ฅ์ ๋ณธ์ธ์ ์๋ API ์์ฒญ ์ ๋งค๋ฒ Access Token์ ๋ฐ๊ธํ๋ ์์ผ๋ก API๋ฅผ ๊ตฌ์ฑํ์๋๋ฐ, ์ด๋ ๊ฒ ๊ตฌ์ฑํ ๊ฒฝ์ฐ ์ฌ์ฉ์๊ฐ ๋ง์์ง ์๋ก ์์คํ ๋ถํ๊ฐ ์ฆ๊ฐํ๋ค. ๋ฐ๋ผ์ Refresh Token์ ๋ฐ๊ธํ๋ ๊ฒ์ด ๋ซ๋ค. ๋ํ, refresh token์ด ์์ ๊ฒฝ์ฐ access token์ ์ ํจ ์๊ฐ์ ์งง๊ฒ ํ์ฌ ํ์ทจ ์ ๋น ๋ฅด๊ฒ ๋ฌดํจํ ์ํฌ ์ ์๋ค. Refresh token์ ๋์ Access Token์ ํตํด User๊ฐ request๋ฅผ ๋ณด๋ด๊ณ , ์ ํจ ์๊ฐ์ด ๋ง๋ฃ ๋์๋ค๋ ์๋ต์ ๋ฐ๋๋ค. User๋ Access Token๊ณ ํจ๊ป Refresh Token์ ์๋ฒ๋ก ๋ณด๋ธ๋ค. Refresh Token์ด ์ ํจํ๋ค๋ฉด ์ ํจ์๊ฐ์ด ๊ฐฑ์ ๋ Access Token์ด ์๋ก ๋ฐ๊ธ๋์ด User..
token์ cookie์ ์ ์ฅํ ์๋, Web Storage์ ์ ์ฅํ ์๋, Client ์์ฒด์ ์ ์ฅํ ์๋ ์๋ค. Cookie ์ฟ ํค๋ ์๋ฒ๊ฐ ๋ณด๋ธ ๋ฐ์ดํฐ๋ฅผ ์ต๋ 4KB๊น์ง ์ ์ฅ ๊ฐ๋ฅํ๋ค. ํด๋ผ์ด์ธํธ์์ Credential ์์ฑ์ผ๋ก ํ์ฉํ๋ฉด ์๋ฒ์์ ์ ๊ทผ ๊ฐ๋ฅํ๋ค. HTTP Request ์ ์๋์ผ๋ก ํฌํจ๋์ด ์๋ฒ์ ์ฟ ํค ์ ๋ณด๋ฅผ ์ ๊ณต ๊ฐ๋ฅํ๋ค. HttpOnly ์ค์ ์ ์ด์ฉํ์ฌ ์ฌ์ฉ์๊ฐ ์ ์ดํ ์ ์๋๋ก ๋ง๋ค ์ ์๋ค. Web Storage Session Storage ์๋ฒ์์ ์ ๊ทผํ ์ ์๋ค. ์ธ์ ์ด ์ข ๋ฃ๋๋ฉด ๋ชจ๋ ์ญ์ ๋๋ค. 5~10MB์ ํฌ๊ธฐ๋ฅผ ๊ฐ๋๋ค. Local Storage ์๋ฒ์์ ์ ๊ทผํ ์ ์๋ค. ๋ฐ ์๊ตฌ์ ์ผ๋ก ์ ์ฅํ ์ ์๋ค. 5~10MB์ ํฌ๊ธฐ๋ฅผ ๊ฐ๋๋ค. Client Side ํด๋ผ์ด์ธํธ ..

๊ฐ๋ ์ ๋ฆฌ ๋ด๊ฐ ์ ๊ณตํ๋ ์๋น์ค๋ฅผ Client, ๋ค๋ฅธ ์๋น์ค๋ฅผ Resource Server, ๋ ์๋น์ค๋ฅผ ๋ชจ๋ ์ด์ฉํ๋ ์ฌ์ฉ์๋ฅผ Resource Owner๋ผ๊ณ ์ ์ํ๋ค. ์ถ๊ฐ์ ์ผ๋ก Resource Server์์ ์ธ์ฆ์ ๋ด๋นํ๋ ์๋ฒ๋ฅผ ๋ฐ๋ก Authorization Server๋ผ๊ณ ํ๋ค. ์ด๋ ๊ฒ ์ฐํฉํด์ ์ธ์ฆ์ฒด๊ณ๋ฅผ ์ ๊ณตํ๋ ๊ฒ์ federated Identity๋ผ๊ณ ๋ถ๋ฅธ๋ค. ๋ฐฐ๊ฒฝ Client๊ฐ Resource Server(google, facebook ๋ฑ)์ ์๋ Resource Owner์ ๊ณ์ ์ ์ ์ํ ์ ์๋ ๋ฐฉ๋ฒ์ ๋ฌด์์ด ์์๊น? Resource Server์ ๋ํ Resource Owner์ id, pw๋ฅผ ์ ๊ณต๋ฐ์ผ๋ฉด ๋ ์ข๊ฒ ์ง๋ง ๋ณด์ ์ ๋ขฐ ๋ฌธ์ ๊ฐ ์๋ค. ๋ฐ๋ผ์ oAuth๊ฐ ๋์๋ค. oAuth๋ฅผ ..
React-query : fetch, cache, synchronize, update(for server state)์ ์ฌ์ฉ๋๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ด๋ค. ๊ณต์์ฌ์ดํธ React Query Hooks for fetching, caching and updating asynchronous data in React react-query.tanstack.com ๋ฐฐ๊ฒฝ server state ์ฌ์ฉ ์ ๋ฐ์ํ ์ ์๋ ๋ฌธ์ ์ ์ ๋ค์๊ณผ ๊ฐ๋ค. caching deduping(๋ฐ์ดํฐ ์ค๋ณต ์ ๊ฑฐ) update "out of date" data / know when is it reflecting updates data pagination optimization, lazy loading data memory management, garba..
query๊ฐ ์ค๋ ๋์๋ค๋ ๊ฒ์ ํ๋จํ๊ณ ๋ค์ fetchํด์ฌ ๋, queryClient.invalidateQueries ํจ์๋ฅผ ์ฌ์ฉํ๋ค. https://react-query.tanstack.com/guides/query-invalidation Query Invalidation Query Invalidation Waiting for queries to become stale before they are fetched again doesn't always work, especially when you know for a fact that a query's data is out of date because of something the user has done. For that purpose, the Quer..
query์ ๋ค๋ฅด๊ฒ CUD์ ์ฌ์ฉ๋๋ค. https://react-query.tanstack.com/guides/mutations Mutations Subscribe to our newsletter The latest TanStack news, articles, and resources, sent to your inbox. react-query.tanstack.com ์ฌ์ฉ์์ const mutation = useMutation(newTodo => axios.post('/todos', newTodo)) return ( {mutation.isLoading ? ( 'Adding todo...' ) : ( {mutation.isError ? ( An error occurred: {mutation.error.mes..
๊ธฐ๋ณธ ์ฌ์ฉ const info = useQuery('unique_key', fetchData); // fetchData๋ promise ๋ฐํ uniqueํ key๋ก ์ ์ํ๋ฉฐ, key์ ๋ฌถ์ด๋ ๋ฐ์ดํฐ๋ ๋น๋๊ธฐ ๋ฐ์ดํฐ์ด๋ค. useQuery๊ฐ ๋ฐํํ๋ result๋ ๋น๋๊ธฐ ๋ฐ์ดํฐ์ ์ํ๋ฅผ ๋ด๊ณ ์๋ค. ์ํ loading isLoading์ด true๊ฐ ๋๋ค. error isError๊ฐ true๊ฐ ๋๋ฉฐ, error์ ์๋ฌ ์ ๋ณด๊ฐ ๋ด๊ธด๋ค. success isSuccess๊ฐ true๊ฐ ๋๋ฉฐ, data์ ์ ๋ณด๊ฐ ๋ด๊ธด๋ค. idle ์ฌ์ฉ ์์ const { isLoading, isError, data, error } = useQuery('key', fetchData); // const { status, data, erro..
Comment