
express static, ์ ์ ํ์ผ ์ ๋ฌํ๊ธฐ
ยท
๐งฑ Framework/Node.js
์ ์ ํ์ผ์ด๋? ๋ณํํ์ง ์๋ ํ์ผ. image, css, jsํ์ผ ๋ฑ์ ์๋ฏธํ๋ค. express์์๋ ์ ์ ํ์ผ์ ์ฝ๊ฒ ์ ๋ฌํ ์ ์๋ ๊ธฐ๋ฅ์ ๊ฐ์ง๊ณ ์๋ค. express.static() express.static ๋ฏธ๋ค์จ์ด์ ํฌํจ์ํค๋ฉฐ ์ ๋ฌํ๋ฉด, ํ์ผ์ ์ง์ ์ ์ธ ์ ๊ณต์ ์์ํ ์ ์๋ค. app.use(expres.static('public')); ์์ ๊ฐ์ด ์์ฑํ๋ค๋ฉด ๋ค์๊ณผ ๊ฐ์ ์ฃผ์๋ก public ๋๋ ํ ๋ฆฌ์ ํฌํจ๋ ํ์ผ์ ๋ก๋ํ ์ ์๋ค. http://localhost:3000/images/kitten.jpg http://localhost:3000/css/style.css http://localhost:3000/js/app.js http://localhost:3000/images/bg.png http..