Intro
์ค๋์ ๋ฆฌ์กํธ์ ๋ค์ด๊ฐ๊ธฐ ์์, ๋ฆฌ์กํธ ์๊ฐ์ Node.js์ ๋ํด ํ์ตํ๋ค.
๋ด์ผ๋ถํฐ ๋ฐฐ์ฐ๊ฒ ๋ ๋ฆฌ์กํธ ๊ธฐ๋๊ฐ ๋๋ค.
์ค๋ ํ์ตํ ๋ด์ฉ
: ํผ๊ทธ๋ง / Node.js
ํผ๊ทธ๋ง - ์ปดํฌ๋ํธ
- ๋ ์ด์ด ํด๋ฆญ ์ Create Component ๋ฒํผ์ด ํ์ฑํ ๋๋ค.
- ์ปดํฌ๋ํธ๋ ๋ ์ด์ด ์์์ ์์ฑ์ด ๋๊ณ ์ต์ด ์ปดํฌ๋ํธ๊ฐ ๋ฉ์ธ ์ปดํฌ๋ํธ๊ฐ ๋๋ค.
- ๋ฉ์ธ ์ปดํฌ๋ํธ๋ฅผ ๊ฐ์ง๊ณ ์ฌ๋ฌ ์ธ์คํด์ค๋ฅผ ๋ค๋ฅธ ํ์ด์ง์์๋ ์์ฑํ ์ ์๋ค.
- ๋ฉ์ธ ์ปดํฌ๋ํธ์ ์ ๋ฐ์ดํธ๊ฐ ๋ฐ์ํ๋ฉด ์๋์ผ๋ก ์ธ์คํด์ค์๋ ์ ๋ฐ์ดํธ๊ฐ ๋๋ค.
- ์ธ์คํด์ค๋ฅผ ์์ ํ๋ ๊ฒ์ ๊ฐ๋ฅํ๋ ๊ฐ๊ธ์ ์ง์ํ๋ค.
- ๋ ๋ฆฝ ๋ ์ด์ด๋ฅผ ์ฌ์ฉํ๊ณ ์ถ๋ค๋ฉด ์ปดํฌ๋ํธ๋ฅผ ํด์ ํ๋ Detach Instance๋ฅผ ํด๋ฆญํด์ผ ํ๋ค.
- ์ค๋ฅธ์ชฝ ์ฌ์ด๋๋ฐ์ ์๋ Properties๋ ๋ฉ์ธ ์ปดํฌ๋ํธ์์๋ง ์ค์ ์ด ๊ฐ๋ฅํ๋ค
- variant: ์ค์ ํ ์ต์ ๊ฐ์ ์ธ์คํด์ค์์ ์ ํํ ์ ์๋ค.
ํผ๊ทธ๋ง ์ปดํฌ๋ํธ ์ค์ต
- variant์์ ๊ฐ์ true/false๋ on/off๋ก ์ค์ ํ ๊ฒฝ์ฐ ์ธ์คํด์ค์์ ์ค์์น ์์ด์ฝ์ผ๋ก ๋ณด์ฌ์ง๊ฒ ๋๋ค.
ํผ๊ทธ๋ง - ๋ฐ์ํ Constraints
- CSS์์ Position๊ณผ ์ ์ฌํ๋ค. (๋ถ๋ชจ์ ๋ง์ถฐ ๋์ํ๋ ๊ธฐ๋ฅ)
- ํ๋ ์ ํ์ ๋ ์ด์ด ํด๋ฆญ ์ Constraints ํ์ฑํ ๋จ
- constraints: ์ ์ฝ, ์ ํ
- ์ํ, ์์ง ์กฐ์ ๊ฐ๋ฅ
- scale: ๋ถ๋ชจ์ ๋์ด์ ๋ฐ๋ผ ํฌ๊ธฐ๊ฐ ์กฐ์ ์ด ๋จ
- cmd + ํ๋ ์ resize๋ฅผ ํ ๊ฒฝ์ฐ, constraints ๊ด๊ณ ์์ด ํ๋ ์ ์ฌ์ด์ฆ๋ฅผ ์์ ๋กญ๊ฒ ๋ฐ๊ฟ ์ ์๋ค.
๐ฉ๐ป Top bar (header)์๋ Left and right, Top์ ์ฃผ๊ณ Bottom bar (footer)๋ Left and right, Bottom์ ์ค์ ํ๋ฉด ๋ฐ์ํ UI๋ฅผ ํธํ๊ฒ ์ ์ํ ์ ์์!!
min width, max width
- ํผ๊ทธ๋ง์ ์๋ก ์ถ๊ฐ๋ ๊ธฐ๋ฅ
- ์คํ ๋ ์ด์์์ด ์ค์ ๋์ด ์์ด์ผ ํ๋ค.
- min width, max width ์ค์ ์ ํฌ๊ธฐ๊ฐ ์ค์ด๋ค์ด/์ปค์ ธ๋ min/max width ์ดํ ํฌ๊ธฐ๋ก ์ค์ด๋ค/์ปค์ง์ง ์๋๋ค.
Node.js ๊ธฐ์ด
์๋ฐ์คํฌ๋ฆฝํธ๋ ์น ๋ธ๋ผ์ฐ์ ์ ๋ด์ฅ๋ ์๋ฐ์คํฌ๋ฆฝํธ ์์ง์ผ๋ก ์คํ์ด ๋๋ค.
๊ธฐ์กด์ ์๋ฐ์คํฌ๋ฆฝํธ๋ ์น ๋ธ๋ผ์ฐ์ ์ธ์์ ์ฌ์ฉํ ์ ์์๋๋ฐ Chrome ๋ธ๋ผ์ฐ์ ์์ ์ฌ์ฉํ๋ ์๋ฐ์คํฌ๋ฆฝํธ ๋ฐํ์์ธ V8์์ง์ผ๋ก ๋ธ๋ผ์ฐ์ ์ธ์์๋ ์ฌ์ฉํ ์ ์๋ ์๋ฐ์คํฌ๋ฆฝํธ ๋ฐํ์์ธ Node.js๊ฐ ๋ฑ์ฅํ๊ฒ ๋์๋ค.
์ดํ, ์ด๋ค ํ๊ฒฝ์์๋ ์๋ฐ์คํฌ๋ฆฝํธ๋ฅผ ์คํํ ์ ์๊ฒ ๋์๋ค.
Node.js๋ฅผ ์๋ฒ ๊ฐ๋ฐ ๊ธฐ์ ๋ก ์๋ชป ์๊ณ ์๋ ๊ฒฝ์ฐ๊ฐ ๊ฝค ์์ผ๋ Node.js๋ ๋จ์ ์๋ฐ์คํฌ๋ฆฝํธ ๋ฐํ์์ด๋ค.
(์๋ฐ์คํฌ๋ฆฝํธ๋ ๊ฒ์์ด๊ณ Node.js๋ ๊ฒ์์ ๊ตฌ๋ํ๋ ๊ฒ์๊ธฐ์ ๋น์ ํ ์ ์๋ค.)'
Node.js ์ค์น
Node.js
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
nodejs.org
LTS(Long Term Support)๋ ์ฅ๊ธฐ์ ์ผ๋ก ์ง์ํ๋ ์์ ์ ์ธ ๋ฒ์ ์ด๋ผ๋ ๋ป์ผ๋ก, ๋ณด์ ์ทจ์ฝ์ ์ด๋ ๊ฒฐํจ์ ๋ํ ์ ์ง ๋ณด์๋ฅผ ์ค๋ซ๋์ ์ง์ํ๋ ์๋ฏธ๋ก LTS ๋ฒ์ ์ ์ค์นํด ์ฌ์ฉํ๋ ๊ฒ์ ๊ถ์ฅํ๋ค.
๋ชจ๋ ๋ด๋ณด๋ด๊ธฐ
require์ด๋ผ๋ Node.js ๋ด์ฅ ํจ์๋ก ๋ชจ๋ ๋ด๋ณด๋ด๊ธฐ๋ฅผ ํ ์ ์๋ค. (node.js์์๋ง ๊ฐ๋ฅํ๋ฏ๋ก ๋ฐ๋๋ผ ์๋ฐ์คํฌ๋ฆฝํธ์์ ๋ถ๊ฐํจ)
- index.js
require('./calc')
console.log(calc.add(1, 2)) // 3
console.log(calc.sub(10, 2)) // 8
- calc.js
const add = (a, b) => a + b
const sub = (a, b) => a - b
module.exports = {
moduleName: 'calc-module',
add: add,
sub: sub
}
module.exports๋ก ๋ด๋ณด๋ด๊ณ require๋ก ๋ถ๋ฌ์ค๋ ๋ชจ๋ ์์คํ โก๏ธ commonJS
์ธ์๋ ๋ชจ๋ ์์คํ ์ผ๋ก ES modules์ด ์กด์ฌํจ (import/export)
ํจํค์ง ์์ฑ - NPM (Node Package Manager)
npm | Home
Bring the best of open source to you, your team, and your company Relied upon by more than 17 million developers worldwide, npm is committed to making JavaScript development elegant, productive, and safe. The free npm Registry has become the center of Java
www.npmjs.com
- npm init
- node.js ํจํค์ง ์ด๊ธฐํ ๋ช ๋ น์ด
- package.json์ด ์์ฑ๋จ
- package-lock.json
- npm install์ ์์ฑ๋จ
- ์ ํํ ๋ฒ์ ๋ช ์ package-lock.json์์ ์ ์ ์๋ค.
๋ง๋ฌด๋ฆฌ
1/30์ผ ๊ฐ์์ ์ค๋ ๊ฐ์๋ฅผ ๋ค ๋ค์๋ค. ๐
๋ด์ผ์ 1/31์ผ ๊ฐ์์ ๋ด์ผ ๊ฐ์ ๋ค ๋๋ด์ผ์ง..!!