์ด ์ ์ฅ์๋ ์ปค๋ฎค๋ํฐ ํ๋ก์ ํธ์ ๋ฐฑ์๋ ์ฝ๋๋ฒ ์ด์ค๋ก, ๋น์ฆ๋์ค ๋ก์ง, ๋ฐ์ดํฐ๋ฒ ์ด์ค ์์ ๋ฐ API ์๋ํฌ์ธํธ๋ฅผ ์ฒ๋ฆฌํฉ๋๋ค. Node.js์ MariaDB๋ก ์ ์๋์์ต๋๋ค.
- ๐ ๊ฒ์๋ฌผ๊ณผ ๋๊ธ์ ๋ํ CRUD ์์ ์ ์ํ RESTful API
- ๐ ์ฌ์ฉ์ ์ธ์ฆ ๋ฐ ์ธ์ ๊ด๋ฆฌ
- ๐ค ์ด๋ฏธ์ง ์ ๋ก๋๋ฅผ ํฌํจํ ํ๋กํ ๊ด๋ฆฌ
- โ๏ธ ๋ฐ์ดํฐ ์ผ๊ด์ฑ์ ์ํ ํธ๋์ญ์ ์ฒ๋ฆฌ
- ๐ ๋ณด์ ๋น๋ฐ๋ฒํธ ํด์ฑ ๋ฐ ๋ฐ์ดํฐ ์ ํจ์ฑ ๊ฒ์ฌ
Node.js: ์๋ฒ์ฌ์ด๋ ๋ฐํ์
Express: ์น ํ๋ ์์ํฌ
MariaDB: ๋ฐ์ดํฐ๋ฒ ์ด์ค
bcrypt: ๋น๋ฐ๋ฒํธ ํด์ฑ
Multer: ํ์ผ ์ ๋ก๋
-
์ ์ฅ์๋ฅผ ํด๋ก ํฉ๋๋ค:
git clone https://github.com/100-hours-a-week/2-hayden-shin-community-be.git cd backend
-
์์กด์ฑ์ ์ค์นํฉ๋๋ค:
npm install
-
๋ฃจํธ ๋๋ ํ ๋ฆฌ์
.env
ํ์ผ์ ์์ฑํฉ๋๋ค:DB_HOST=localhost DB_USER=root DB_PASSWORD=yourpassword DB_DATABASE=community SESSION_SECRET=yoursecret
-
์๋ฒ๋ฅผ ์์ํฉ๋๋ค:
npm start
โโโ controller/
โ โโโ post.js
โ โโโ comment.js
โ โโโ auth.js
โโโ model/
โ โโโ post.js
โ โโโ comment.js
โ โโโ auth.js
โโโ router/
โ โโโ post.js
โ โโโ comment.js
โ โโโ auth.js
โโโ db/
โ โโโ database.js
- POST /auth/signup: ์๋ก์ด ์ฌ์ฉ์ ์์ฑ
- POST /auth/login: ์ฌ์ฉ์ ๋ก๊ทธ์ธ
- POST /auth/logout: ํ์ฌ ์ฌ์ฉ์ ๋ก๊ทธ์์
- GET /posts: ๋ชจ๋ ๊ฒ์๋ฌผ ์กฐํ
- GET /posts/:post_id: ํน์ ๊ฒ์๋ฌผ ์กฐํ
- POST /posts: ์ ๊ฒ์๋ฌผ ์์ฑ
- PATCH /posts/:post_id: ๊ฒ์๋ฌผ ์์
- DELETE /posts/:post_id: ๊ฒ์๋ฌผ ์ญ์
- GET /posts/:post_id/comments: ํน์ ๊ฒ์๋ฌผ์ ๋ชจ๋ ๋๊ธ ์กฐํ
- POST /posts/:post_id/comments: ํน์ ๊ฒ์๋ฌผ์ ๋๊ธ ์ถ๊ฐ
- PATCH /comments/:comment_id: ๋๊ธ ์์
- DELETE /comments/:comment_id: ๋๊ธ ์ญ์
- id, username, email, password, profileImage, createdAt
- id, title, content, image, userId, likeCount, viewCount, commentCount, createdAt, updatedAt
- id, postId, content, userId, createdAt, updatedAt
- id, postId, userId, createdAt
-
์ ์ฅ์๋ฅผ ํฌํฌํฉ๋๋ค.
-
์๋ก์ด ๋ธ๋์น๋ฅผ ์์ฑํฉ๋๋ค:
git checkout -b feature-name
-
๋ณ๊ฒฝ ์ฌํญ์ ์ปค๋ฐํฉ๋๋ค:
git commit -m "feat: add feature"
-
๋ธ๋์น๋ฅผ ํธ์ํฉ๋๋ค:
git push origin feature-name
-
ํ ๋ฆฌํ์คํธ๋ฅผ ์์ฑํฉ๋๋ค.
์ด ํ๋ก์ ํธ๋ MIT ๋ผ์ด์ ์ค๋ฅผ ๋ฐ๋ฆ ๋๋ค.