public/index.html)# Git ์ค์น ํ ์คํ
git clone https://github.com/JinJun-han/elimgweb.git
cd elimgweb
์ถ์ฒ ์๋ํฐ:
Ctrl + S (Windows) / Cmd + S (Mac)์ผ๋ก ์ ์ฅ# ํฐ๋ฏธ๋์์ ์คํ
npm install # ์ฒ์ ํ ๋ฒ๋ง
npm run init # ์ฒ์ ํ ๋ฒ๋ง
npm run dev # ์๋ฒ ์์
# ๋ธ๋ผ์ฐ์ ์์ ์ด๊ธฐ
http://localhost:3000
git add .
git commit -m "์์ ๋ด์ฉ ์ค๋ช
"
git push origin main
elimgweb/
โโโ public/
โ โโโ index.html โญ ๋ฉ์ธ ์นํ์ด์ง (์ฌ๊ธฐ๋ฅผ ๊ฐ์ฅ ๋ง์ด ์์ )
โโโ server/
โ โโโ index.js โญ ์๋ฒ ๋ฉ์ธ ํ์ผ
โ โโโ routes/
โ โ โโโ api.js โญ API ์๋ํฌ์ธํธ
โ โ โโโ admin.js โญ ๊ด๋ฆฌ์ ๊ธฐ๋ฅ
โ โโโ models/
โ โ โโโ database.js ๐ ๋ฐ์ดํฐ๋ฒ ์ด์ค ๊ตฌ์กฐ
โ โโโ init-db.js ๐ง ์ด๊ธฐ ๋ฐ์ดํฐ ์ค์
โโโ i18n/
โ โโโ ko.json ๐ฐ๐ท ํ๊ตญ์ด ๋ฒ์ญ
โ โโโ en.json ๐บ๐ธ ์์ด ๋ฒ์ญ
โ โโโ vi.json ๐ป๐ณ ๋ฒ ํธ๋จ์ด ๋ฒ์ญ
โโโ .env โ๏ธ ํ๊ฒฝ ์ค์ (๋น๋ฐ๋ฒํธ ๋ฑ)
โโโ package.json ๐ฆ ํ๋ก์ ํธ ์ ๋ณด
โโโ README.md ๐ ํ๋ก์ ํธ ์ค๋ช
| ํ์ผ | ์์ ๋ด์ฉ | ๋์ด๋ |
|---|---|---|
public/index.html |
ํ ์คํธ, ์ด๋ฏธ์ง, ๋์์ธ | โญ ์ฌ์ |
i18n/ko.json |
ํ๊ตญ์ด ๋ฒ์ญ | โญ ์ฌ์ |
server/init-db.js |
์ด๊ธฐ ๋ด์ค/๋ฐ์ดํฐ | โญโญ ๋ณดํต |
.env |
๋น๋ฐ๋ฒํธ, ์ค์ | โญโญ ๋ณดํต |
server/routes/api.js |
API ๊ธฐ๋ฅ ์ถ๊ฐ | โญโญโญ ์ด๋ ค์ |
ํ์ผ: public/index.html
์ฐพ๊ธฐ:
<h1 class="hero-title">์ธ์์ ํฅํ ํ๋๋์ ์ฌ๋</h1>
์์ :
<h1 class="hero-title">์ฌ๋์ผ๋ก ์ฌ๊ธฐ๋ ๊ธ๋ก์ปฌ ์ ๊ต</h1>
์ฐพ๊ธฐ:
<p class="hero-subtitle">๊ธ๋ก์ปฌ ์ ๊ต์ ๋น์ฆ๋์ค๋ก ๋ณต์์ ์ ํฉ๋๋ค</p>
์์ :
<p class="hero-subtitle">์ด์ฃผ๋ฏผ๊ณผ ํจ๊ป ํ๋๋ ๋๋ผ๋ฅผ ์ธ์๋๋ค</p>
ํ์ผ: public/index.html
์ฐพ๊ธฐ:
<img src="https://via.placeholder.com/150x50/4A90E2/ffffff?text=ELIM+G" alt="์๋ฆผG์ ๊ตํ">
์์ : (๋ณธ์ธ ์ด๋ฏธ์ง URL๋ก ๊ต์ฒด)
<img src="https://elimg.com/logo.png" alt="์๋ฆผG์ ๊ตํ">
์ฐพ๊ธฐ:
.hero {
background: url('https://images.unsplash.com/photo-1517486808906-6ca8b3f04846');
}
์์ :
.hero {
background: url('https://elimg.com/hero-background.jpg');
}
ํ์ผ: public/index.html์ <style> ์น์
์ฐพ๊ธฐ:
:root {
--primary-color: #4A90E2;
--secondary-color: #50C878;
}
์์ : (์ํ๋ ์์ ์ฝ๋๋ก)
:root {
--primary-color: #FF6B6B; /* ๋นจ๊ฐ์ ๊ณ์ด */
--secondary-color: #4ECDC4; /* ์ฒญ๋ก์ ๊ณ์ด */
}
๐ก ์์ ์ฝ๋ ์ฐพ๊ธฐ: https://htmlcolorcodes.com/
ํ์ผ: public/index.html
์ฐพ๊ธฐ:
<p>๐ 010-2083-3106</p>
์์ :
<p>๐ 010-1234-5678</p>
์ฐพ๊ธฐ:
<p>โ๏ธ kodhjj@gmail.com</p>
์์ :
<p>โ๏ธ contact@elimg.com</p>
ํ์ผ: public/index.html
์ฐพ๊ธฐ:
<div class="account-number" id="accountNumber">
301-0296-7179-91
</div>
์์ :
<div class="account-number" id="accountNumber">
123-456-7890-12
</div>
ํ์ผ: server/init-db.js
์ฐพ๊ธฐ:
const sampleNews = [
{
title_ko: '๊ฑฐ์ ์ฐธ๋นํ๋ง์ผํฐ ๊ฐ์์',
// ...
}
];
์ถ๊ฐ:
const sampleNews = [
{
title_ko: '๊ฑฐ์ ์ฐธ๋นํ๋ง์ผํฐ ๊ฐ์์',
// ... ๊ธฐ์กด ๋ด์ฉ
},
{
title_ko: '์๋ก์ด ์์ ์ ๋ชฉ',
title_en: 'New News Title',
title_vi: 'Tiรชu ฤแป tin mแปi',
content_ko: '์๋ก์ด ์์ ๋ด์ฉ...',
content_en: 'New news content...',
content_vi: 'Nแปi dung tin mแปi...',
category: '๊ณต์ง',
author: '๊ด๋ฆฌ์',
image_url: 'https://images.unsplash.com/photo-xxx'
}
];
์ ์ฉ:
npm run init # ๋ฐ์ดํฐ๋ฒ ์ด์ค ์ฌ์ด๊ธฐํ
ํ์ผ: i18n/ko.json, i18n/en.json, i18n/vi.json
i18n/ko.json)์ฐพ๊ธฐ:
{
"nav": {
"home": "ํ",
"about": "์๊ฐ"
}
}
์์ :
{
"nav": {
"home": "๋ฉ์ธ",
"about": "์ฐ๋ฆฌ๋"
}
}
ํ์ผ: public/index.html
์ฐพ๊ธฐ:
<div class="faq-item">
<div class="faq-question">
<h3>Q. ํ์๊ธ์ ์ด๋ป๊ฒ ์ฌ์ฉ๋๋์?</h3>
<span class="faq-icon">+</span>
</div>
<div class="faq-answer">
<p>ํ์๊ธ์ 100% ์ด์ฃผ๋ฏผ ์ง์ ์ฌ์ญ์ ์ฌ์ฉ๋ฉ๋๋ค...</p>
</div>
</div>
์์ /์ถ๊ฐ:
<div class="faq-item">
<div class="faq-question">
<h3>Q. ์๋ก์ด ์ง๋ฌธ ์ ๋ชฉ?</h3>
<span class="faq-icon">+</span>
</div>
<div class="faq-answer">
<p>์๋ก์ด ๋ต๋ณ ๋ด์ฉ์ ์ฌ๊ธฐ์ ์์ฑํฉ๋๋ค...</p>
</div>
</div>
ํ์ผ: public/index.html
์ถ๊ฐํ ์์น ์ฐพ๊ธฐ (์: FAQ ์น์ ๋ค์)
</section> <!-- FAQ ๋ -->
<!-- ์ฌ๊ธฐ์ ์ ์น์
์ถ๊ฐ -->
<section class="my-new-section">
<div class="container">
<h2>์๋ก์ด ์น์
์ ๋ชฉ</h2>
<p>๋ด์ฉ...</p>
</div>
</section>
<footer> <!-- ํธํฐ ์์ -->
CSS ์คํ์ผ ์ถ๊ฐ (index.html์ <style> ํ๊ทธ ์)
.my-new-section {
padding: 80px 0;
background: #f5f5f5;
}
.my-new-section h2 {
text-align: center;
margin-bottom: 40px;
color: var(--primary-color);
}
ํ์ผ: server/routes/api.js
์์: ์๋ก์ด ํต๊ณ API
// ๊ธฐ์กด ์ฝ๋ ์๋์ ์ถ๊ฐ
router.get('/statistics', (req, res) => {
try {
const stats = db.prepare(`
SELECT
COUNT(*) as total_news,
(SELECT COUNT(*) FROM partners) as total_partners,
(SELECT SUM(amount) FROM donations) as total_donations
FROM news
`).get();
res.json({
success: true,
stats
});
} catch (error) {
res.status(500).json({
success: false,
message: 'ํต๊ณ ์กฐํ ์คํจ'
});
}
});
์ฌ์ฉ:
GET https://elimg.com/api/statistics
ํ์ผ: server/routes/admin.js
์์: ๋ฐฉ๋ฌธ์ ํต๊ณ ๋ฆฌ์ ๊ธฐ๋ฅ
// ๊ด๋ฆฌ์ ์ ์ฉ ์๋ํฌ์ธํธ
router.post('/reset-visitors', authenticateAdmin, (req, res) => {
try {
db.prepare('UPDATE settings SET value = 0 WHERE key = "visitor_count"').run();
res.json({
success: true,
message: '๋ฐฉ๋ฌธ์ ์๊ฐ ์ด๊ธฐํ๋์์ต๋๋ค'
});
} catch (error) {
res.status(500).json({
success: false,
message: '์ด๊ธฐํ ์คํจ'
});
}
});
ํ์ผ: server/models/database.js
์์: ์ด๋ฒคํธ ํ ์ด๋ธ ์ถ๊ฐ
// ํ
์ด๋ธ ์์ฑ ํจ์์ ์ถ๊ฐ
db.exec(`
CREATE TABLE IF NOT EXISTS events (
id INTEGER PRIMARY KEY AUTOINCREMENT,
title_ko TEXT NOT NULL,
title_en TEXT,
title_vi TEXT,
date DATE NOT NULL,
location TEXT,
description TEXT,
image_url TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
)
`);
# 1. ๋ณ๊ฒฝ์ฌํญ ํ์ธ
git status
# 2. ๋ชจ๋ ๋ณ๊ฒฝ์ฌํญ ์คํ
์ด์ง
git add .
# 3. ์ปค๋ฐ (์์ ๋ด์ฉ ์ค๋ช
)
git commit -m "์ฐ๋ฝ์ฒ ์ ๋ณด ์
๋ฐ์ดํธ"
# 4. GitHub์ ํธ์
git push origin main
Railway/Vercel ์ฐ๊ฒฐ ์: ์๋์ผ๋ก 1-2๋ถ ๋ด ๋ฐฐํฌ ์๋ฃ!
# 1. ์๋ฒ ์ ์
ssh root@your-server-ip
# 2. ํ๋ก์ ํธ ํด๋๋ก ์ด๋
cd /var/www/elimgweb
# 3. ์ต์ ์ฝ๋ ๊ฐ์ ธ์ค๊ธฐ
git pull origin main
# 4. ์์กด์ฑ ์
๋ฐ์ดํธ (ํ์์)
npm install
# 5. ์๋ฒ ์ฌ์์
pm2 restart elimg
๋ฐฐํฌ ์ ํ์ธ์ฌํญ:
npm run dev).env ํ์ผ์ด GitHub์ ์
๋ก๋๋์ง ์์๋๊ฐ?ํด๊ฒฐ:
# ๋ธ๋ผ์ฐ์ ์บ์ ์ญ์
Ctrl + Shift + R (Windows)
Cmd + Shift + R (Mac)
# ๋๋ ์ํฌ๋ฆฟ ๋ชจ๋๋ก ์ ์
ํด๊ฒฐ:
# ๋ก๊ทธ ํ์ธ
npm run dev
# ๋๋ PM2 ๋ก๊ทธ
pm2 logs elimg
# ๋ฐ์ดํฐ๋ฒ ์ด์ค ์ฌ์ด๊ธฐํ
npm run init
ํด๊ฒฐ:
# ์ต์ ์ฝ๋ ๋จผ์ ๊ฐ์ ธ์ค๊ธฐ
git pull origin main
# ์ถฉ๋ ํด๊ฒฐ ํ ๋ค์ ํธ์
git add .
git commit -m "์ถฉ๋ ํด๊ฒฐ"
git push origin main
# ์์ ์ ํญ์ ๋ฐฑ์
!
git branch backup-$(date +%Y%m%d)
# ๋ก์ปฌ์์ ํ๋ก๋์
๋ชจ๋ ํ
์คํธ
NODE_ENV=production npm start
์ด ๊ฐ์ด๋๋ฅผ ๋ถ๋งํฌํ์ธ์! ๐
์์ ํ ๋๋ง๋ค ์ฐธ๊ณ ํ์๋ฉด ๋ฉ๋๋ค. ๊ถ๊ธํ ์ ์ด ์์ผ๋ฉด ์ธ์ ๋ ์ง ๋ฌธ์ํด์ฃผ์ธ์! ๐