넥스트js

[next.js]환경변수

민ズl 2024. 12. 12. 19:36

환경변수명 : NEXT_PUBLIC_~~~

NEXT_PUBLIC_API_SERVER_URL=http://localhost:12345

 

환경변수 적용시

const response = await fetch(`${process.env.NEXT_PUBLIC_API_SERVER_URL}/post`);

 

[공식문서]

 

Configuring: Environment Variables | Next.js

Learn to add and access environment variables in your Next.js application.

nextjs.org

 

'넥스트js' 카테고리의 다른 글

[next.js]dynamic 옵션  (0) 2024.12.12
[next.js]캐싱  (0) 2024.12.12
[next.js] React Server Component, Client Router Cache  (0) 2024.12.12
[next.js]Link, pre-fetching, fallback  (0) 2024.12.12
[next.js] page router vs app router  (0) 2024.12.12