Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] post project 일부 구현 #4

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.env
8 changes: 4 additions & 4 deletions config/db.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import dotenv from 'dotenv';
dotenv.config();

export const pool = mysql.createPool({
host: process.env.DB_HOST || 'localhost', // mysql의 hostname
user: process.env.DB_USER || 'root', // user 이름
host: process.env.DB_HOST || 'awseb-e-f9vmi2gbfp-stack-awsebrdsdatabase-ymzzikmm6fmi.chsrz6xqicas.ap-northeast-2.rds.amazonaws.com', // mysql의 hostname
user: process.env.DB_USER || 'umc', // user 이름
port: process.env.DB_PORT || 3306, // 포트 번호
database: process.env.DB_TABLE || 'umc', // 데이터베이스 이름
password: process.env.DB_PASSWORD || 'joon5849', // 비밀번호
database: process.env.DB_TABLE || 'UMC-ENTP', // 데이터베이스 이름
password: process.env.DB_PASS || '12345678', // 비밀번호
waitForConnections: true,
// Pool에 획득할 수 있는 connection이 없을 때,
// true면 요청을 queue에 넣고 connection을 사용할 수 있게 되면 요청을 실행하며, false이면 즉시 오류를 내보내고 다시 요청
Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { response } from './config/response.js';
import { BaseError } from './config/error.js';
import { status } from './config/response.status.js';
import { healthRoute } from './src/routes/health.route.js';
import { projectRouter } from './src/routes/project.route.js';

dotenv.config(); // .env 파일 사용 (환경 변수 관리)

Expand All @@ -23,6 +24,7 @@ app.use(express.urlencoded({extended: false})); // 단순 객체 문자열 형
app.use('/api-docs', SwaggerUi.serve, SwaggerUi.setup(specs));

app.use('/health', healthRoute);
app.use('/project', projectRouter);

app.get('/', (req, res, next) => {
res.send(response(status.SUCCESS, "루트 페이지!"));
Expand Down

Large diffs are not rendered by default.

100 changes: 100 additions & 0 deletions node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

102 changes: 102 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
"cors": "^2.8.5",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"express-async-handler": "^1.2.0",
"http-status-code": "^2.1.0",
"http-status-codes": "^2.3.0",
"mysql": "^2.18.1",
"mysql2": "^3.6.5",
"passport": "^0.7.0",
"passport-kakao": "^1.0.1",
"passport-local": "^1.0.0"
Expand Down
16 changes: 16 additions & 0 deletions src/controllers/project.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { response } from "../../config/response.js";
import { status } from "../../config/response.status.js";

import { uploadProject, viewProject } from "../services/project.service.js";

export const projectPost = async (req, res, next) => {
console.log("게시글 작성을 요청하였습니다!");

res.send(response(status.SUCCESS, await uploadProject(req.body)));
}

// export const projectGet = async (req, res, next) => {
// console.log("게시글 조회를 요청하였습니다!");

// res.send(response(status.SUCCESS, await viewProject(req.body)));
// }
7 changes: 7 additions & 0 deletions src/dtos/project.dto.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const postResponseDTO = (user_id) => {
return {"user_id": user_id};
}

// export const getResponseDTO = (data) => {
// return {""}
// }
Loading