๐ 2022.07.21 ~ 2022.08.15
FE 4๋ช , BE 4๋ช ์ผ๋ก ๊ตฌ์ฑ๋ ํ ํ๋ก์ ํธ๋ก ์ปค์คํ ๋ฉ๋ด์ ํฅ๋ฏธ๊ฐ ์๋ ์ฌ์ฉ์๋ค์ด ์์ ์ ์ปค์คํ ๋ฉ๋ด๋ฅผ ๊ณต์ ํ๊ณ ๋ฆฌ๋ทฐํ ์ ์๋ SNS ํ๋ซํผ ์ ๋๋ค.
TypeScript
React.js
Next.js
Emotion
Axios
Git
Vercel
React-query
Recoil
Vercel
Atom
์ ์ฌ์ฉํด ํด๋น Atom
์ ๊ตฌ๋
ํ๋ ์ปดํฌ๋ํธ๋ง ๋ฆฌ๋ ๋๋ง ํ๊ธฐ์ ๋ค๋ฅธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ณด๋ค ์ข๋ค๊ณ ์๊ฐํ๊ธฐ ๋๋ฌธ์
๋๋ค.API๊ฐ ์คํ์์ค๊ฐ ์๋๊ธฐ์ nextConfig
์ rewrites
๋ฅผ ํตํด API๋ฅผ ์๋ํ๋๋กํ๊ณ , ์บ์ฑ ์ด๋ฏธ์ง๋ฅผ ์ฌ์ฉํ๊ธฐ ์ํด ์ด๋ฏธ์ง ๋๋ฉ์ธ ์ฃผ์๋ฅผ ๋ฑ๋กํด์คฌ์ต๋๋ค.
๋, ์ด๋ฅผ ํตํด ํ๋ก ํธ์๋ ์๋ฒ๋ฅผ ํ๋ก์ ์๋ฒ๋ก ์ฌ์ฉํด HTTPS๋ฅผ ์ฌ์ฉํ๋ ํ๋ก ํธ์๋ ์๋ฒ์์ HTTP ๋ฐฑ์๋ API๋ฅผ ํธ์ถํ ์ ์๋๋ก ํ์ต๋๋ค.
const API_KEY = process.env.NEXT_PUBLIC_API_URL
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
images: {
domains: [
'user-images.githubusercontent.com',
'masiottae-image-bucket.s3.ap-northeast-2.amazonaws.com'
]
},
async rewrites() {
return [
{
source: '/api/:path*',
destination: `${API_KEY}/:path*`
}
]
}
}
module.exports = nextConfig
nextConfig
์ rewrites
๋ฅผ ํตํด API๋ฅผ ์๋ํ๊ณ ์๊ธฐ ๋๋ฌธ์, axios instance
์ baseUrl์ '/api'๋ก ๋๊ณ '/api' ๋ท ๋ถ๋ถ๋ง ๋ฐ์ url๋ก ๋๊ธฐ๋๋ก ํ์ต๋๋ค.