[Vite+React]Vite + React ์„ค์น˜ + Postgresql(MacOS)

๐Ÿ‘‰๐Ÿป Vite + ๋ฆฌ์•กํŠธ ์„ค์น˜ ๋ฐ ์‹คํ–‰(MacOS)
Installing and Running Vite + React (MacOS)

โœ”๏ธ Vite+React์—์„œ Vite๋ž€ ํ”„๋ž‘์Šค์–ด๋กœ ๋น ๋ฅด๋‹ค๋ผ๋Š” ๋œป์ž…๋‹ˆ๋‹ค.
In Vite+React, Vite means fast in French.

โœ”๏ธ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์„ ๊ตฌ์ถ•ํ•˜๊ณ  ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜๋Š” ์†๋„๋ฅผ ํš๊ธฐ์ ์œผ๋กœ ๊ฐœ์„ ํ•˜๋Š” ๊ฒƒ์„ ๋ชฉํ‘œ๋กœ ๋งŒ๋“ค์–ด์กŒ์Šต๋‹ˆ๋‹ค.
It was created with the goal of dramatically improving the speed at which you can set up your development environment and run your code.

โœ”๏ธ Vite+๋ฆฌ์•กํŠธ๋ž€? UI ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ (์ปดํฌ๋„ŒํŠธ ๋งŒ๋“ค๊ธฐ)๋นŒ๋“œ ๋„๊ตฌ[react] + ๊ฐœ๋ฐœ ์„œ๋ฒ„[vite]
What is Vite+React? A UI library (for building components) and a build tool (React) + a development server (Vite).

โœ”๏ธ ๋ณดํ†ต nginx๊ฐ€ React๋ฅผ ์„œ๋น™ํ•˜๊ณ  nodejs express๋ž‘ ์—ฐ๋™์„ ํ•ฉ๋‹ˆ๋‹ค.
Usually nginx serves React and connects with nodejs express.

# 1. ์ตœ์‹  Vite + React + TypeScript ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ 
# Create a modern Vite + React + TypeScript project
npm create vite@latest myvideo-admin --template react-ts

# ๋งŒ์•ฝ yarn ์“ฐ๋Š” ๊ฒฝ์šฐ
# If you use yarn
# yarn create vite myvideo-admin --template react-ts

# 2. ํ”„๋กœ์ ํŠธ ํด๋”๋กœ ์ด๋™
#Go to project folder
cd myvideo-admin

# 3. ์˜์กด์„ฑ ์„ค์น˜
# Installing dependencies
npm install

# 4. ๊ฐœ๋ฐœ ์„œ๋ฒ„ ์‹คํ–‰ (์ž๋™์œผ๋กœ ๋ธŒ๋ผ์šฐ์ € ์—ด๋ฆผ)
# Run the development server (browser opens automatically)
npm run dev

โœ”๏ธ ์Šคํฌ๋ฆฐ์ƒท/ScreenShot

๐Ÿ‘‰๐Ÿปpostgresql ์„ค์น˜(MacOS) / Start,Stop the PostgreSQL Service (MacOS)

โœ”๏ธ ์„ค์น˜ / install

brew install postgresql@17  

โœ”๏ธ ํ™˜๊ฒฝ๋ณ€์ˆ˜์„ค์ • ๋ฐ ์‹คํ–‰ / Setting environment variables and running

# Homebrew postgresql@17์˜ bin ๊ฒฝ๋กœ ์ถ”๊ฐ€ (Apple Silicon Mac ๊ธฐ์ค€)
# Added bin path for Homebrew postgresql@17 (based on Apple Silicon Macs)
echo 'export PATH="/opt/homebrew/opt/postgresql@17/bin:$PATH"' >> ~/.zshrc

# Intel Mac์ด๋ฉด /usr/local/opt/... ์ผ ์ˆ˜ ์žˆ์Œ โ†’ ์•„๋ž˜๋กœ ๋Œ€์ฒด
# If you have an Intel Mac, it may be /usr/local/opt/... โ†’ Replace with below
# echo 'export PATH="/usr/local/opt/postgresql@17/bin:$PATH"' >> ~/.zshrc

# ๋ณ€๊ฒฝ ์ ์šฉ (ํ„ฐ๋ฏธ๋„ ์žฌ์‹œ์ž‘ ์—†์ด ๋ฐ”๋กœ)
# Apply changes (immediately without restarting the terminal)
source ~/.zshrc

# ๋‹ค์‹œ ํ™•์ธ
# check again
psql --version

# ์‹คํ–‰ ,Mac์—์„œ๋Š”์ด๋ ‡๊ฒŒ ์‹คํ–‰ํ•˜๋ฉด ๋จ ์ˆ˜ํผ์œ ์ €๊ฐ€ postgres๊ฐ€ ์•„๋‹˜.
# Run , on Mac, run like this. The superuser is not postgres.
psql postgres

โœ”๏ธ postgresql ์„œ๋น„์Šค ์‹œ์ž‘ ์ข…๋ฃŒ(MacOS)
Start,Stop the PostgreSQL Service (MacOS)

brew services start postgresql@17 # start
brew services stop postgresql@17 # stop

โœ”๏ธ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ ‘์† / Database connection

psql postgres

Leave a Reply