diff --git a/backend/models/board.js b/backend/models/board.js index 09d270d4dde17b9c09af274d3fec1a807297407e..df231a1af6b6b50788c915c016eb7e95b7bb4e5b 100644 --- a/backend/models/board.js +++ b/backend/models/board.js @@ -7,6 +7,7 @@ const BoardSchema = new mongoose.Schema({ hobby: { type: String }, created_at: { type: Date, default: Date.now }, picture: { type: String }, + writer: { type: String }, }); // mongoose.connect("mongodb://localhost:27017/local", { diff --git a/backend/routes/users.js b/backend/routes/users.js index 076c1b686b1590a5b2ebc1fd9918bfb1c08614a4..770996dd1c80ef1f6e65f3177aa5fbe295919d16 100644 --- a/backend/routes/users.js +++ b/backend/routes/users.js @@ -289,6 +289,7 @@ router.post("/writeBoard", upload.array("photo", 1), function (req, res) { content: req.body.content, hobby: req.body.hobby, picture: filename, + writer: req.session.user.id, }); save_board.save(); @@ -299,4 +300,20 @@ router.post("/writeBoard", upload.array("photo", 1), function (req, res) { } }); +router.post("/getDetailBoard", async function (req, res) { + let id = req.body.id; + console.log("/getDetailBoard호츨됨." + req.body.id); + + try { + let detailBoard = await BoardModel.findOne({ _id: id }); + + console.log("detailBoard: "); + console.log(detailBoard); + + res.send(detailBoard); + } catch (err) { + console.log(err); + } +}); + module.exports = router; diff --git a/backend/uploads/serverless_computing_infographic1607167284961.PNG b/backend/uploads/serverless_computing_infographic1607167284961.PNG new file mode 100644 index 0000000000000000000000000000000000000000..ac38bfe00a851523d2515b248398fbc004b2ccb1 Binary files /dev/null and b/backend/uploads/serverless_computing_infographic1607167284961.PNG differ diff --git "a/backend/uploads/\354\272\241\354\262\23011607112474219.PNG" "b/backend/uploads/\354\272\241\354\262\23011607112474219.PNG" new file mode 100644 index 0000000000000000000000000000000000000000..896408389ccdb368a2f5b3c8e7c5f66bf640dbf0 Binary files /dev/null and "b/backend/uploads/\354\272\241\354\262\23011607112474219.PNG" differ diff --git a/frontend/.eslintcache b/frontend/.eslintcache index 12286b87b5398e7f0684c73cc3e0535276944ffc..00ff95da4148ceb0dc4f2fec9e142becc05c3ec3 100644 --- a/frontend/.eslintcache +++ b/frontend/.eslintcache @@ -1 +1 @@ -[{"C:\\WYH\\frontend\\src\\reportWebVitals.js":"1","C:\\WYH\\frontend\\src\\App.js":"2","C:\\WYH\\frontend\\src\\index.js":"3","C:\\WYH\\frontend\\src\\components\\Profile.js":"4","C:\\WYH\\frontend\\src\\components\\Board.js":"5","C:\\WYH\\frontend\\src\\components\\Home.js":"6","C:\\WYH\\frontend\\src\\components\\Signup.js":"7","C:\\WYH\\frontend\\src\\components\\Login.js":"8","C:\\WYH\\frontend\\src\\components\\WriteBoard.js":"9"},{"size":362,"mtime":1606157613272,"results":"10","hashOfConfig":"11"},{"size":1218,"mtime":1607099502736,"results":"12","hashOfConfig":"11"},{"size":544,"mtime":1606240034288,"results":"13","hashOfConfig":"11"},{"size":1175,"mtime":1606662802658,"results":"14","hashOfConfig":"11"},{"size":1355,"mtime":1607107572555,"results":"15","hashOfConfig":"11"},{"size":370,"mtime":1606662762631,"results":"16","hashOfConfig":"11"},{"size":1575,"mtime":1606662809909,"results":"17","hashOfConfig":"11"},{"size":1232,"mtime":1606662786263,"results":"18","hashOfConfig":"11"},{"size":3419,"mtime":1607104090152,"results":"19","hashOfConfig":"11"},{"filePath":"20","messages":"21","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"10w9ldj",{"filePath":"22","messages":"23","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"24","messages":"25","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"26","messages":"27","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"28","messages":"29","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"30","messages":"31","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"32","messages":"33","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"34"},{"filePath":"35","messages":"36","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"37"},{"filePath":"38","messages":"39","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":"40"},"C:\\WYH\\frontend\\src\\reportWebVitals.js",[],"C:\\WYH\\frontend\\src\\App.js",["41"],"C:\\WYH\\frontend\\src\\index.js",[],"C:\\WYH\\frontend\\src\\components\\Profile.js",[],"C:\\WYH\\frontend\\src\\components\\Board.js",["42","43"],"C:\\WYH\\frontend\\src\\components\\Home.js",["44"],"C:\\WYH\\frontend\\src\\components\\Signup.js",["45"],"import React, { useState } from \"react\";\r\n//import { post } from \"../../backend/app\";\r\nimport { post } from \"axios\";\r\n\r\nconst Signup = () => {\r\n const [email, setEmail] = useState(\"\");\r\n const [nicname, setNicname] = useState(\"\");\r\n const [password, setPassword] = useState(\"\");\r\n\r\n const onChangeEmail = (e) => setEmail(e.target.value);\r\n const onChangeNicname = (e) => setNicname(e.target.value);\r\n const onChangePassword = (e) => setPassword(e.target.value);\r\n\r\n // const handleFormSubmit = () => {\r\n // const url = \"/signup\";\r\n // const formData = new FormData();\r\n // formData.append(\"username\", username);\r\n // formData.append(\"password\", password);\r\n // formData.append(\"nicname\", nicname);\r\n\r\n // const config = {\r\n // headers: {\r\n // \"content-type\": \"multipart/form-data\",\r\n // },\r\n // };\r\n\r\n // return post(url, formData, config);\r\n // };\r\n\r\n return (\r\n <form action=\"http://localhost:3001/signup\" method=\"post\">\r\n <h1>회원가입</h1>\r\n 이메일:\r\n <input\r\n type=\"text\"\r\n name=\"email\"\r\n value={email}\r\n onChange={onChangeEmail}\r\n ></input>\r\n 비밀번호:\r\n <input\r\n type=\"password\"\r\n name=\"password\"\r\n value={password}\r\n onChange={onChangePassword}\r\n ></input>\r\n 닉네임:\r\n <input\r\n type=\"text\"\r\n name=\"nicname\"\r\n value={nicname}\r\n onChange={onChangeNicname}\r\n ></input>\r\n <button type=\"submit\">가입완료</button>\r\n </form>\r\n );\r\n};\r\n\r\nexport default Signup;\r\n","C:\\WYH\\frontend\\src\\components\\Login.js",["46"],"import React, { useState } from \"react\";\r\nimport { post } from \"axios\";\r\n\r\nconst Login = () => {\r\n const [username, setUsername] = useState(\"\");\r\n const [password, setPassword] = useState(\"\");\r\n\r\n const onChangeUsername = (e) => setUsername(e.target.value);\r\n const onChangePassword = (e) => setPassword(e.target.value);\r\n\r\n // const handleFormSubmit = () => {\r\n // const url = \"/login\";\r\n // let formData = new FormData();\r\n // formData.append(\"username\", username);\r\n // formData.append(\"password\", password);\r\n\r\n // let config = {\r\n // headers: {\r\n // \"content-type\": \"multipart/form-data\",\r\n // },\r\n // };\r\n\r\n // return post(url, formData, config);\r\n // };\r\n\r\n return (\r\n <form action=\"http://localhost:3001/login\" method=\"post\">\r\n <h1>로그인 화면</h1>\r\n 이메일:\r\n <input\r\n type=\"text\"\r\n name=\"email\"\r\n value={username}\r\n onChange={onChangeUsername}\r\n ></input>\r\n 비밀번호:\r\n <input\r\n type=\"password\"\r\n name=\"password\"\r\n value={password}\r\n onChange={onChangePassword}\r\n ></input>\r\n <button type=\"submit\">로그인</button>\r\n </form>\r\n );\r\n};\r\n\r\nexport default Login;\r\n","C:\\WYH\\frontend\\src\\components\\WriteBoard.js",["47","48","49","50"],"import React, { useState } from \"react\";\r\n\r\nconst WriteBoard = () => {\r\n const [title, setTitle] = useState(\"\");\r\n const [content, setContent] = useState(\"\");\r\n const [hobby, setHobby] = useState(\"\");\r\n\r\n const onChangeTitle = (e) => setTitle(e.target.value);\r\n const onChangeContent = (e) => setContent(e.target.value);\r\n const onChangeHobby = (e) => setHobby(e.target.value);\r\n\r\n return (\r\n <div>\r\n <form\r\n action=\"http://localhost:3001/writeBoard\"\r\n method=\"post\"\r\n encType=\"multipart/form-data\"\r\n >\r\n <label>제목</label>\r\n <input type=\"text\" name=\"title\" onChange={onChangeTitle}></input>\r\n <br></br>\r\n <label>본문</label>\r\n <textarea\r\n type=\"text\"\r\n name=\"content\"\r\n onChange={onChangeContent}\r\n ></textarea>\r\n <br></br>\r\n <label>취미</label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"ex/sp\" name=\"hobby\" />\r\n 운동/스포츠\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"out/tr\" name=\"hobby\" />\r\n 아웃도어/여행\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"bk/wr\" name=\"hobby\" />\r\n 인문학/책/글\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"fg/lg\" name=\"hobby\" />\r\n 외국/언어\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"cul/pfm\" name=\"hobby\" />\r\n 문화/공연\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"mu/inst\" name=\"hobby\" />\r\n 음악/악기\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"cft\" name=\"hobby\" />\r\n 공예/만들기\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"dan\" name=\"hobby\" />\r\n 댄스/무용\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"volu\" name=\"hobby\" />\r\n 봉사활동\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"par\" name=\"hobby\" />\r\n 사교/인맥\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"game\" name=\"hobby\" />\r\n 게임/오락\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"pic\" name=\"hobby\" />\r\n 사진/편집/촬영/영상\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"inv\" name=\"hobby\" />\r\n 제테크/투자\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"cok/fod\" name=\"hobby\" />\r\n 요리/음식/맛집\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"fas/bea\" name=\"hobby\" />\r\n 패션/뷰티/코디\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"art/draw\" name=\"hobby\" />\r\n 미술/그림\r\n </label>\r\n <br></br>\r\n <br></br>\r\n <label>사진첨부</label>\r\n <input type=\"file\" name=\"photo\"></input>\r\n <br></br>\r\n <button type=\"submit\">ok</button>\r\n </form>\r\n </div>\r\n );\r\n};\r\n\r\nexport default WriteBoard;\r\n",{"ruleId":"51","severity":1,"message":"52","line":1,"column":17,"nodeType":"53","messageId":"54","endLine":1,"endColumn":26},{"ruleId":"51","severity":1,"message":"55","line":2,"column":10,"nodeType":"53","messageId":"54","endLine":2,"endColumn":15},{"ruleId":"56","severity":1,"message":"57","line":8,"column":13,"nodeType":"58","endLine":26,"endColumn":4},{"ruleId":"51","severity":1,"message":"55","line":2,"column":10,"nodeType":"53","messageId":"54","endLine":2,"endColumn":15},{"ruleId":"51","severity":1,"message":"59","line":3,"column":10,"nodeType":"53","messageId":"54","endLine":3,"endColumn":14},{"ruleId":"51","severity":1,"message":"59","line":2,"column":10,"nodeType":"53","messageId":"54","endLine":2,"endColumn":14},{"ruleId":"51","severity":1,"message":"60","line":4,"column":10,"nodeType":"53","messageId":"54","endLine":4,"endColumn":15},{"ruleId":"51","severity":1,"message":"61","line":5,"column":10,"nodeType":"53","messageId":"54","endLine":5,"endColumn":17},{"ruleId":"51","severity":1,"message":"62","line":6,"column":10,"nodeType":"53","messageId":"54","endLine":6,"endColumn":15},{"ruleId":"51","severity":1,"message":"63","line":10,"column":9,"nodeType":"53","messageId":"54","endLine":10,"endColumn":22},"no-unused-vars","'Component' is defined but never used.","Identifier","unusedVar","'Route' is defined but never used.","react-hooks/exhaustive-deps","Effect callbacks are synchronous to prevent race conditions. Put the async function inside:\n\nuseEffect(() => {\n async function fetchData() {\n // You can await here\n const response = await MyAPI.getData(someId);\n // ...\n }\n fetchData();\n}, [someId]); // Or [] if effect doesn't need props or state\n\nLearn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching","ArrowFunctionExpression","'post' is defined but never used.","'title' is assigned a value but never used.","'content' is assigned a value but never used.","'hobby' is assigned a value but never used.","'onChangeHobby' is assigned a value but never used."] \ No newline at end of file +[{"C:\\WYH\\frontend\\src\\reportWebVitals.js":"1","C:\\WYH\\frontend\\src\\App.js":"2","C:\\WYH\\frontend\\src\\index.js":"3","C:\\WYH\\frontend\\src\\components\\Profile.js":"4","C:\\WYH\\frontend\\src\\components\\Board.js":"5","C:\\WYH\\frontend\\src\\components\\Home.js":"6","C:\\WYH\\frontend\\src\\components\\Signup.js":"7","C:\\WYH\\frontend\\src\\components\\Login.js":"8","C:\\WYH\\frontend\\src\\components\\WriteBoard.js":"9","C:\\WYH\\frontend\\src\\components\\DetailBoard.js":"10"},{"size":362,"mtime":1606157613272,"results":"11","hashOfConfig":"12"},{"size":1342,"mtime":1607112446370,"results":"13","hashOfConfig":"12"},{"size":544,"mtime":1606240034288,"results":"14","hashOfConfig":"12"},{"size":1175,"mtime":1606662802658,"results":"15","hashOfConfig":"12"},{"size":1622,"mtime":1607166854480,"results":"16","hashOfConfig":"12"},{"size":370,"mtime":1606662762631,"results":"17","hashOfConfig":"12"},{"size":1575,"mtime":1606662809909,"results":"18","hashOfConfig":"12"},{"size":1232,"mtime":1606662786263,"results":"19","hashOfConfig":"12"},{"size":3419,"mtime":1607104090152,"results":"20","hashOfConfig":"12"},{"size":1095,"mtime":1607167155777,"results":"21","hashOfConfig":"12"},{"filePath":"22","messages":"23","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"10w9ldj",{"filePath":"24","messages":"25","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"26","messages":"27","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"28","messages":"29","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"30","messages":"31","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"32","messages":"33","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"34","messages":"35","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"36"},{"filePath":"37","messages":"38","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"39"},{"filePath":"40","messages":"41","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":"42"},{"filePath":"43","messages":"44","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"C:\\WYH\\frontend\\src\\reportWebVitals.js",[],"C:\\WYH\\frontend\\src\\App.js",["45"],"C:\\WYH\\frontend\\src\\index.js",[],"C:\\WYH\\frontend\\src\\components\\Profile.js",[],"C:\\WYH\\frontend\\src\\components\\Board.js",["46","47"],"C:\\WYH\\frontend\\src\\components\\Home.js",["48"],"C:\\WYH\\frontend\\src\\components\\Signup.js",["49"],"import React, { useState } from \"react\";\r\n//import { post } from \"../../backend/app\";\r\nimport { post } from \"axios\";\r\n\r\nconst Signup = () => {\r\n const [email, setEmail] = useState(\"\");\r\n const [nicname, setNicname] = useState(\"\");\r\n const [password, setPassword] = useState(\"\");\r\n\r\n const onChangeEmail = (e) => setEmail(e.target.value);\r\n const onChangeNicname = (e) => setNicname(e.target.value);\r\n const onChangePassword = (e) => setPassword(e.target.value);\r\n\r\n // const handleFormSubmit = () => {\r\n // const url = \"/signup\";\r\n // const formData = new FormData();\r\n // formData.append(\"username\", username);\r\n // formData.append(\"password\", password);\r\n // formData.append(\"nicname\", nicname);\r\n\r\n // const config = {\r\n // headers: {\r\n // \"content-type\": \"multipart/form-data\",\r\n // },\r\n // };\r\n\r\n // return post(url, formData, config);\r\n // };\r\n\r\n return (\r\n <form action=\"http://localhost:3001/signup\" method=\"post\">\r\n <h1>회원가입</h1>\r\n 이메일:\r\n <input\r\n type=\"text\"\r\n name=\"email\"\r\n value={email}\r\n onChange={onChangeEmail}\r\n ></input>\r\n 비밀번호:\r\n <input\r\n type=\"password\"\r\n name=\"password\"\r\n value={password}\r\n onChange={onChangePassword}\r\n ></input>\r\n 닉네임:\r\n <input\r\n type=\"text\"\r\n name=\"nicname\"\r\n value={nicname}\r\n onChange={onChangeNicname}\r\n ></input>\r\n <button type=\"submit\">가입완료</button>\r\n </form>\r\n );\r\n};\r\n\r\nexport default Signup;\r\n","C:\\WYH\\frontend\\src\\components\\Login.js",["50"],"import React, { useState } from \"react\";\r\nimport { post } from \"axios\";\r\n\r\nconst Login = () => {\r\n const [username, setUsername] = useState(\"\");\r\n const [password, setPassword] = useState(\"\");\r\n\r\n const onChangeUsername = (e) => setUsername(e.target.value);\r\n const onChangePassword = (e) => setPassword(e.target.value);\r\n\r\n // const handleFormSubmit = () => {\r\n // const url = \"/login\";\r\n // let formData = new FormData();\r\n // formData.append(\"username\", username);\r\n // formData.append(\"password\", password);\r\n\r\n // let config = {\r\n // headers: {\r\n // \"content-type\": \"multipart/form-data\",\r\n // },\r\n // };\r\n\r\n // return post(url, formData, config);\r\n // };\r\n\r\n return (\r\n <form action=\"http://localhost:3001/login\" method=\"post\">\r\n <h1>로그인 화면</h1>\r\n 이메일:\r\n <input\r\n type=\"text\"\r\n name=\"email\"\r\n value={username}\r\n onChange={onChangeUsername}\r\n ></input>\r\n 비밀번호:\r\n <input\r\n type=\"password\"\r\n name=\"password\"\r\n value={password}\r\n onChange={onChangePassword}\r\n ></input>\r\n <button type=\"submit\">로그인</button>\r\n </form>\r\n );\r\n};\r\n\r\nexport default Login;\r\n","C:\\WYH\\frontend\\src\\components\\WriteBoard.js",["51","52","53","54"],"import React, { useState } from \"react\";\r\n\r\nconst WriteBoard = () => {\r\n const [title, setTitle] = useState(\"\");\r\n const [content, setContent] = useState(\"\");\r\n const [hobby, setHobby] = useState(\"\");\r\n\r\n const onChangeTitle = (e) => setTitle(e.target.value);\r\n const onChangeContent = (e) => setContent(e.target.value);\r\n const onChangeHobby = (e) => setHobby(e.target.value);\r\n\r\n return (\r\n <div>\r\n <form\r\n action=\"http://localhost:3001/writeBoard\"\r\n method=\"post\"\r\n encType=\"multipart/form-data\"\r\n >\r\n <label>제목</label>\r\n <input type=\"text\" name=\"title\" onChange={onChangeTitle}></input>\r\n <br></br>\r\n <label>본문</label>\r\n <textarea\r\n type=\"text\"\r\n name=\"content\"\r\n onChange={onChangeContent}\r\n ></textarea>\r\n <br></br>\r\n <label>취미</label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"ex/sp\" name=\"hobby\" />\r\n 운동/스포츠\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"out/tr\" name=\"hobby\" />\r\n 아웃도어/여행\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"bk/wr\" name=\"hobby\" />\r\n 인문학/책/글\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"fg/lg\" name=\"hobby\" />\r\n 외국/언어\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"cul/pfm\" name=\"hobby\" />\r\n 문화/공연\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"mu/inst\" name=\"hobby\" />\r\n 음악/악기\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"cft\" name=\"hobby\" />\r\n 공예/만들기\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"dan\" name=\"hobby\" />\r\n 댄스/무용\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"volu\" name=\"hobby\" />\r\n 봉사활동\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"par\" name=\"hobby\" />\r\n 사교/인맥\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"game\" name=\"hobby\" />\r\n 게임/오락\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"pic\" name=\"hobby\" />\r\n 사진/편집/촬영/영상\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"inv\" name=\"hobby\" />\r\n 제테크/투자\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"cok/fod\" name=\"hobby\" />\r\n 요리/음식/맛집\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"fas/bea\" name=\"hobby\" />\r\n 패션/뷰티/코디\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"art/draw\" name=\"hobby\" />\r\n 미술/그림\r\n </label>\r\n <br></br>\r\n <br></br>\r\n <label>사진첨부</label>\r\n <input type=\"file\" name=\"photo\"></input>\r\n <br></br>\r\n <button type=\"submit\">ok</button>\r\n </form>\r\n </div>\r\n );\r\n};\r\n\r\nexport default WriteBoard;\r\n","C:\\WYH\\frontend\\src\\components\\DetailBoard.js",["55","56"],{"ruleId":"57","severity":1,"message":"58","line":1,"column":17,"nodeType":"59","messageId":"60","endLine":1,"endColumn":26},{"ruleId":"57","severity":1,"message":"61","line":2,"column":10,"nodeType":"59","messageId":"60","endLine":2,"endColumn":15},{"ruleId":"62","severity":1,"message":"63","line":8,"column":13,"nodeType":"64","endLine":27,"endColumn":4},{"ruleId":"57","severity":1,"message":"61","line":2,"column":10,"nodeType":"59","messageId":"60","endLine":2,"endColumn":15},{"ruleId":"57","severity":1,"message":"65","line":3,"column":10,"nodeType":"59","messageId":"60","endLine":3,"endColumn":14},{"ruleId":"57","severity":1,"message":"65","line":2,"column":10,"nodeType":"59","messageId":"60","endLine":2,"endColumn":14},{"ruleId":"57","severity":1,"message":"66","line":4,"column":10,"nodeType":"59","messageId":"60","endLine":4,"endColumn":15},{"ruleId":"57","severity":1,"message":"67","line":5,"column":10,"nodeType":"59","messageId":"60","endLine":5,"endColumn":17},{"ruleId":"57","severity":1,"message":"68","line":6,"column":10,"nodeType":"59","messageId":"60","endLine":6,"endColumn":15},{"ruleId":"57","severity":1,"message":"69","line":10,"column":9,"nodeType":"59","messageId":"60","endLine":10,"endColumn":22},{"ruleId":"62","severity":1,"message":"63","line":8,"column":13,"nodeType":"64","endLine":21,"endColumn":4},{"ruleId":"62","severity":1,"message":"63","line":23,"column":13,"nodeType":"64","endLine":31,"endColumn":4},"no-unused-vars","'Component' is defined but never used.","Identifier","unusedVar","'Route' is defined but never used.","react-hooks/exhaustive-deps","Effect callbacks are synchronous to prevent race conditions. Put the async function inside:\n\nuseEffect(() => {\n async function fetchData() {\n // You can await here\n const response = await MyAPI.getData(someId);\n // ...\n }\n fetchData();\n}, [someId]); // Or [] if effect doesn't need props or state\n\nLearn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching","ArrowFunctionExpression","'post' is defined but never used.","'title' is assigned a value but never used.","'content' is assigned a value but never used.","'hobby' is assigned a value but never used.","'onChangeHobby' is assigned a value but never used."] \ No newline at end of file diff --git a/frontend/src/App.js b/frontend/src/App.js index fd9c652fc42db1fe83bf925da4865f594faf30c5..37eff427465cc7c85220f8e449748f652ac62b72 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js @@ -6,6 +6,7 @@ import Signup from "./components/Signup"; import Profile from "./components/Profile"; import Board from "./components/Board"; import WriteBoard from "./components/WriteBoard"; +import DetailBoard from "./components/DetailBoard"; //class App extends Component { // state = { @@ -39,6 +40,7 @@ const App = () => { <Route path="/profile" component={Profile} /> <Route path="/board" component={Board} /> <Route path="/writeBoard" component={WriteBoard} /> + <Route path="/detailBoard/:board_id" component={DetailBoard} /> </div> ); }; diff --git a/frontend/src/components/Board.js b/frontend/src/components/Board.js index 9406104b1676202faa004a427d2546f60664bd28..1b57b68cac6f6136310b1c02bc6eef99ddbaa9a4 100644 --- a/frontend/src/components/Board.js +++ b/frontend/src/components/Board.js @@ -18,6 +18,7 @@ const Board = () => { // console.log(err); // } async function fetchData() { + console.log("react board get axios 호출"); const result = await axios.get("http://localhost:3001/board"); console.log(result.data); setResponse(result.data); @@ -37,7 +38,12 @@ const Board = () => { <ol> {response.map((res) => ( <li key={res._id}> - <Link to="/detailBoard"> + {/* <Link to={`/detailBoard/${res._id}`}> + <div onClick={handleOnClick(res._id)}> + {res.title} {res.created_at} + </div> + </Link> */} + <Link to={`/detailBoard/${res._id}`}> {res.title} {res.created_at} </Link> </li> diff --git a/frontend/src/components/DetailBoard.js b/frontend/src/components/DetailBoard.js new file mode 100644 index 0000000000000000000000000000000000000000..3c2de64757c93ca5fc0959e9294c6ccb70ed4266 --- /dev/null +++ b/frontend/src/components/DetailBoard.js @@ -0,0 +1,44 @@ +import React, { useEffect, useState } from "react"; +import axios from "axios"; + +const DetailBoard = ({ match }) => { + const { boardId } = match.params; + const [Board, setBoard] = useState([]); + + useEffect(async () => { + async function postData() { + console.log("react detailBoard axios post 호출1"); + axios + .post("http://localhost:3001/getDetailBoard", { id: boardId }) + .then(function (response) { + console.log(response); + }) + .catch((err) => { + console.log(err); + }); + } + postData(); + }); + + useEffect(async () => { + async function fetchData() { + console.log("react detailBoard axios post 호출2"); + const result = await axios.post("http://localhost:3001/getDetailBoard"); + console.log(result.data); + setBoard(result.data); + } + fetchData(); + }, []); + + return ( + <div> + {Board.map((b) => ( + <div> + <div>{b.title}</div> <div>{b.content}</div> + </div> + ))} + </div> + ); +}; + +export default DetailBoard;