묻고 답해요
156만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
해결됨React, Node.js, MongoDB로 만드는 나만의 회사 웹사이트: 완벽 가이드
ch5-1 관리자 페이지 IP블랙리스트 기능구현 관련
안녕하세요..아래와 같이 에러가뜨는데요;; code: 'MODULE_NOT_FOUND', requireStack: [ '/Users/sungwon/Desktop/Project/Web/company_website/backend/index.js' ]}Node.js v24.4.0[nodemon] app crashed - waiting for file changes before starting....backend > index.js코드 입니다.require("dotenv").config(); const express = require("express"); const mongoose = require("mongoose"); const cookieParser = require("cookie-parser"); const cors = require("cors"); const app = express(); const PORT = 3000; const userRoutes = require("./routes/user"); app.use(express.json()) app.use(express.urlencoded()) app.use(cookieParser()); app.use(cors({ origin: "*", credentials: true, })); app.use("/api/auth", userRoutes); app.get("/", (req, res) => { res.send("Hello world"); }); app.get("/api/check-ip", (req, res) => { const clientIP = req.ip || req.connection.remoteAddress; const blacklistedIPs = JSON.parse(process.env.IP_BLACKLIST || '[]'); console.log("Client IP:", clientIP); console.log("Blacklisted IPs:", blacklistedIPs); if (blacklistedIPs.includes(clientIP)) { return res.status(403).json({ allowed: false, message: "Access denied - IP is blacklisted" }); } res.json({ allowed: true }); }); mongoose .connect(process.env.MONGO_URI) .then(() => console.log("MongoDB와 연결이 되었습니다.")) .catch((error) => console.log("MongoDB와 연결에 실패했습니다: ", error)); app.listen(PORT, () => { console.log("Server is running"); });
-
미해결비전공자를 위한 진짜 입문 올인원 개발 부트캠프
그랩님, 상품 상세 페이지 에러와 의문점 질문드립니다.
그랩님, 강의 잘 듣고 있습니다.다름이 아니라, 상품 상세 페이지 에러와 의문점이 있어서 어떻게 해결해야 하는지 궁금한 사항이 있어 질문 드리게 되었습니다.일단 src/main/index.js 소스 코드를 첨부합니다.import './index.css'; import axios from "axios"; import React from 'react'; import {Link} from 'react-router-dom'; function MainPage(){ const [products, setProducts]=React.useState([]); React.useEffect( function(){ axios.get("제 mock 서버 주소 넣었습니다/products") .then(function(result){ const products=result.data.products; setProducts(products); }).catch(function(error){ console.error("에러 발생:",error); }); },[]); return ( <div> <div id="header"> <div id="header-area"> <img src="../images/icons/logo.png" /> </div> </div> <div id="body"> <div id="banner"> <img src="../images/banners/banner1.png" /> </div> <h1>판매되는 상품들</h1> <div id="product-list"> { products.map(function(product, index){ return ( <div className="product-card"> <Link className="product-link" to={`/products/${product.id}`}> <div> <img className="product-img" src={product.imageUrl} /> </div> <div className="product-contents"> <span className="product-name">{product.name} </span> <span className="product-price">{product.price}원 </span> <div className="product-seller"> <img className="product-avatar" src="../images/icons/avatar.png" /> <span>{product.seller}</span> </div> </div> </Link> </div> ); }) } </div> </div> <div id="footer"></div> </div> ); } export default MainPage;2.src/product/index.js 소스 첨부합니다.import {useParams} from 'react-router-dom'; import axios from "axios"; import { useEffect, useState } from 'react'; function ProductPage(){ // const params=useParams(); const {id} = useParams(); const [product, setProduct] = useState(null); useEffect(function(){ axios.get('제 mock 서버 주소 넣었습니다/products/${id}' ) .then(function (result) { setProduct(result.data); // console.log(result); }).catch(function(error){ console.error(error); } ); },[]); console.log(product); // console.log(params); return <h1>상품 상세 페이지 {id} 상품</h1>; } export default ProductPage;-->여기서부터 의문점과 문제점이 발생하게 되니 읽어주시고 해결할 수 있는 방법을 알려주시면 좋겠습니다. 위 소스에서axios.get('제 mock 서버 주소 넣었습니다/products/${id}') 처럼 소스를 달러 중괄호 아이디 입력하면, 아래와 같은 첨부 사진처럼 에러가 납니다. --> 위 에러 첨부 사진은 어떻게 해결해야 할까요?3. 하지만, 위 소스대로 입력 안하면 axios.get('제 mock 서버 주소 넣었습니다/products/1') 하면 제대로 데이터를 오류 없이 아래 첨부 사진처럼 받아 오는 것을 알 수 있습니다. 3-1. 그랩님, 강의 소스에서 처럼 axios.get('제 mock 서버 주소 넣었습니다/products/${id}')해서 하면 위 첨부 사진 처럼 에러가 나는데요, 성공적으로 오류 없이 불러오고 싶은데요, 어떻게 해야 하나요? 단계별로 어떻게 소스를 수정해야하는지 알려주시면 좋겠습니다.확인하시면 답변 부탁 드립니다.
-
해결됨React, Node.js, MongoDB로 만드는 나만의 회사 웹사이트: 완벽 가이드
ch4-6 관리자 계정 로그아웃 , 삭제 관련
7:27 시점에서, 터미널에서 선생님은,,eyJhbGcioiJOUzI1N,......주소명이 뜹니다만,,,저의 경우, 아래와 같이 몽고DB에 연결이 되었습니다만 뜹니다.... 이 경우 어떻게 해야할가요... [nodemon] starting node index.js[dotenv@17.2.1] injecting env (2) from .env -- tip: 🔐 prevent committing .env to code: https://dotenvx.com/precommitServer is runningMongoDB와 연결이 되었습니다.[nodemon] restarting due to changes...[nodemon] starting node index.js[nodemon] restarting due to changes...[nodemon] starting node index.js[dotenv@17.2.1] injecting env (2) from .env -- tip: ⚙ suppress all logs with { quiet: true }Server is runningMongoDB와 연결이 되었습니다. 아래는 routes폴더에 있는 user.jsconst express = require("express"); const router = express.Router(); const bcrypt = require("bcrypt"); const User = require("../models/User"); const axios = require("axios"); const jwt = require("jsonwebtoken"); router.post("/signup", async (req, res) => { try { const { username, password } = req.body; const existingUser = await User.findOne({ username }); if (existingUser) { return res.status(400).json({ message: "이미 존재하는 사용자입니다." }); } const hashedPassword = await bcrypt.hash(password, 10); const user = new User({ username, password: hashedPassword, }); await user.save(); res.status(201).json({ message: "회원가입이 완료되었습니다." }); } catch (error) { res.status(500).json({ message: "서버 오류가 발생했습니다." }); console.log(error); } }); router.post("/login", async (req, res) => { try { const { username, password } = req.body; const user = await User.findOne({ username }).select("+password"); if(!user) { return res.status("401").json({message: "사용자를 찾을 수 없습니다."}); } if(!user.isActive){ return res .status(401) .json({ message: "비활성화된 계정입니다. 관리자에게 문의 주세요."}); } if(user.isLoggedIn){ return res .status(401) .json({message: "이미 다른 기기에서 로그인되어 있습니다."}); } const isValidPassword = await bcrypt.compare(password, user.password); if(!isValidPassword){ user.failedLoginAttempts += 1; user.lastLoginAttempt = new Date(); if(user.failedLoginAttempts >= 5){ user.isActive = false; await user.save(); return res.status(401).json({ message: "비밀번호를 5회이상 틀려 계정이 비활성화되었습니다.", }); } await user.save(); return res.status(401).json({ message: "비밀번호가 일치하지 않습니다.", remainingAttempts: 5 - user.failedLoginAttempts, }); } user.failedLoginAttempts = 0; user.lastLoginAttempt = new Date(); user.isLoggedIn = true; try { const response = await axios.get("https://api.ipify.org?format=json"); const ipAddress = response.data.ip; user.ipAddress = ipAddress; } catch (ipError) { console.error("IP 주소를 가져오는 중 오류 발생:", ipError.message); } await user.save(); const token = jwt.sign( { userId: user._id, username: user.username }, process.env.JWT_SECRET, { expiresIn: "24h" } ); res.cookie("token", token, { httpOnly: true, secure: "production", sameSite: "strict", maxAge: 24 * 60 * 60 * 1000, }); const userWithoutPassword = user.toObject(); delete userWithoutPassword.password; res.json({ user: userWithoutPassword }); } catch (error) { console.error("서버 오류:", error.message); res.status(500).json({ message: "서버 오류가 발생했습니다." }); } }); router.post("/logout", async (req, res) => { try { const token = req.cookies.token; if (!token) { return res.status(400).json({ message: "이미 로그아웃된 상태입니다." }); } try { const decoded = jwt.verify(token, process.env.JWT_SECRET); const user = await User.findById(decoded.userId); if (user) { user.isLoggedIn = false; await user.save(); } } catch (error) { console.log("토큰 검증 오류: ", error.message); } res.clearCookie("token", { httpOnly: true, secure: "production", sameSite: "strict", }); res.json({ message: "로그아웃되었습니다." }); } catch (error) { console.log("로그아웃 오류: ", error.message); res.status(500).json({ message: "서버 오류가 발생했습니다." }); } }); router.delete("/delete/:userId", async (req, res) => { try { const user = await User.findByIdAndDelete(req.params.userId); if (!user) { return res.status(404).json({ message: "사용자를 찾을 수 없습니다." }); } res.json({ message: "사용자가 성공적으로 삭제되었습니다." }); } catch (error) { res.status(500).json({ message: "서버 오류가 발생했습니다." }); } }); module.exports = router; env.에 표기한 부분MONGO_URI=mongodb+srv://sungwon5623:cho121101!@sungwon.oirqw5d.mongodb.net/?retryWrites=true&w=majority&appName=Sungwon JWT_SECRET=c21b6ba5372fa2b8 models폴더에 있는 User.jsconst mongoose = require("mongoose"); const userSchema = new mongoose.Schema( { username: { type: String, required: true, trim: true, minlength: 2, maxlength: 30, }, password: { type: String, required: true, select: false, }, isLoggedIn: { type: Boolean, default: false, }, isActive: { type: Boolean, default: true, }, failedLoginAttempts: { type: Number, default: 0, }, lastLoginAttempt: { type: Date, }, ipAddress: { type: String, trim: true, }, createdAt: { type: Date, default: Date.now, }, }, { timestamps: true, } ); const User = mongoose.model("User", userSchema); module.exports = User;
-
미해결웹디자인개발기능사 [2025년] 실기전체 (카톡질문가능)
공지사항과 갤러리html파트 강의자료가 없음.
다운로드할 수 있는 강의 자료의 부재로 수업을 진행하는데 어려움이 있음, 강의 제목 옆에 다운로드 버튼도 없을 뿐더러 동영상 재생바 하단에도 자료 다운로드가 없음 강의 자료가 없어서 강의 진행에 어려움이 있어요
-
미해결TailwindCSS 완벽 마스터: 포트폴리오부터 어드민까지!
quasar와 tailwind 조합에 관한 질문
강사님!질문이 있습니다. 질문이 좀 길어요. 죄송합니다.커뮤니티에도 질문을 올렸는데 휴가 중이신지 답변이 없어서 여기에도 남겨봅니다.Vue3 모든 과정을 수강하고 덕분에 프로젝트도 수행을 잘 했습니다. 그런데 프로젝트 할 때 quasar와 사용자 css 적용 문제로 퍼블리셔들이 고생을 많이 했습니다. 저는 PM 역할을 수행합니다. quasar의 css가 사용자가 정의한 css를 덮어 쓰는 경향이 있어 처리한다고 퍼블리셔 분들이 고생들을 많이 했어요. 그래서 다시 프로젝트를 곧 수행할 것 같은데 이번에는 tailwind를 적용해 볼려고 해요. 그러면 nuxt3 + vue3 + quasar + tailwind로 생각하고 있는데 그런데 저희는 포털은 웹 접근성 심사를 받아야 해서 이 조합이 맞는지가 궁금합니다. quasar가 다른 css를 덮어 쓰는 문제가 발생해서 tailwind로 작성한 css도 무용지물이 될까 심히 걱정스럽습니다.
-
미해결처음 만난 리액트(React)
이거 왜 존재하지 않는다고 뜨는건가요
이거 왜 존재하지 않는다고 뜨는건가요
-
미해결HTML+CSS+JS 포트폴리오 실전 퍼블리싱(시즌1)
강의듣는법
■ 질문 남기실 때 꼭! 참고해주세요.- 먼저 유사한 질문이 있었는지 검색해주세요.- 궁금한 부분이 있으시면 해당 강의의 타임라인 부분을 표시해주시면 좋습니다.- HTML, CSS, JQUERY 코드 소스를 텍스트 형태로 첨부해주시고 스크린샷도 첨부해주세요.- 다운로드가 필요한 파일은 해당 강의의 마지막 섹션에 모두 있습니다.책같은거없나요? 그냥 강의들으면되요?
-
해결됨React, Node.js, MongoDB로 만드는 나만의 회사 웹사이트: 완벽 가이드
ch4-5 관리자 계정 로그인, JWT토큰 관련
덕분에 무사히 다음 강의 듣고있는데요또 막혔습니다;;; MongoDB는 연결이 잘되는데요;;{ id : new ObjectId(''''')등등 터미널에 admin과 패스워드 등의 데이터카 안뜹니다;;;
-
해결됨React, Node.js, MongoDB로 만드는 나만의 회사 웹사이트: 완벽 가이드
ch4-4관리자 계정생성하기 문제 발생
아래와 같은 오류가 발생됩니다.... Error: Cannot find module 'bcrypt'Require stack:- /Users/sungwon/Desktop/Project/Web/company_website/backend/routes/user.js- /Users/sungwon/Desktop/Project/Web/company_website/backend/index.js at Module._resolveFilename (node:internal/modules/cjs/loader:1369:15) at defaultResolveImpl (node:internal/modules/cjs/loader:1025:19) at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1030:22) at Module._load (node:internal/modules/cjs/loader:1179:37) at TracingChannel.traceSync (node:diagnostics_channel:322:14) at wrapModuleLoad (node:internal/modules/cjs/loader:235:24) at Module.require (node:internal/modules/cjs/loader:1449:12) at require (node:internal/modules/helpers:135:16) at Object.<anonymous> (/Users/sungwon/Desktop/Project/Web/company_website/backend/routes/user.js:3:16) at Module._compile (node:internal/modules/cjs/loader:1692:14) { code: 'MODULE_NOT_FOUND', requireStack: [ '/Users/sungwon/Desktop/Project/Web/company_website/backend/routes/user.js', '/Users/sungwon/Desktop/Project/Web/company_website/backend/index.js' ]}Node.js v24.4.0[nodemon] app crashed - waiting for file changes before starting... 아래는 index.js 코드입니다.require('dotenv').config(); const express = require('express'); const mongoose = require('mongoose'); const app = express(); const PORT =3000; const userRoutes = require("./routes/user"); app.use('/api/auth',userRoutes); app.get('/', (req, res) => { res.send('Hello World!'); }); mongoose.connect(process.env.MONGO_URI) .then(() => console.log('MongoDB와 연결이 되었습니다.')) .catch((error)=> console.log('MongoDB와 연결이 실패하였습니다:',error)); app.listen(PORT, () => { console.log("Server is running"); })models>User.js 코드입니다.const mongoose = require('mongoose'); const userSchema = new mongoose.Schema( { username:{ type:String, require: true, trim: true, minlength:2, maxlength:30, }, password:{ type:String, require:true, select: false, }, isLoggedIn:{ type:Boolean, default:false, }, isActive:{ type:Boolean, default:false, }, failedLoginAttempts:{ type:Number, default:0, }, lastLoginAttempts:{ type:Date, }, ipAddress:{ type:String, trim:true, }, createdAt:{ type:Date, default: Date.now, } }, { timestamps:true, } ); const User = mongoose.model('User', userSchema); module.exports = User; routes>user.js코드 입니다.const express = require('express'); const router = express.Router(); const bcrypt = require('bcrypt'); const User = require('../models/User'); router.post('/signup', async (req, res) => { try { const {username, password} = req.body; const existingUser=await User.findOne({username}); if(existingUser){ return res.status(400).json({message:'이미 존재하는 사용자 입니다.'}); } const hashedPassword = await bcrypt.hash(password,10); const user = new User({ username, password:hashedPassword, }) await user.save(); res.status(201).json({message:'회원가입이 완료되었습니다.'}); } catch(error){ res.status(500).json({message:'서버 오류가 발생되었습니다.'}); console.log(error); } }); module.exports = router;
-
미해결HTML+CSS+JS 포트폴리오 실전 퍼블리싱(시즌1)
아코디언 만들기 100%이하의 화면으로 보았을때
안녕하세요 선생님 강의 잘 듣고 있습니다.위의 예제에서 100%~90%이상의 화면은 문제 없는데 80%이하로 갔을 경우 이미지와 같이 분리되는 현상을 해결할 방법은없을까요?
-
미해결입문자를 위한 HTML 기초 강의
#7강_VS Code New Folder 생성 문의
안녕하세요. #7강 관련 문의드립니다. VS Code 에서 index.html 작성 까지는 따라갔는데 이후 New Folder 생성 관련해서 이후 New Folder를 어떻게 생성해야하는건지 상위 카테고리인 'CODE'부분도 나오지 않고 마우스 좌측 클릭으로도 클릭해봤지만 나오지않아 따라가다 막혔습니다..ㅠ
-
미해결입문자를 위한, HTML&CSS 웹 개발 입문
html설명하실때 접속시는 e북 링크는 어디에 있나요
두고두고 보고싶은데 못찾겠어요ㅠㅠ
-
미해결구글 애드센스 수익형 워드프레스 블로그 만들기
홈페이지 메인화면에 이미지 짤림
안녕하세요 글을 작성했는데메인 화면에서 글에 작성한 이미지가 안보입니다문제가 뭔지 모르겠어요ㅜㅜ
-
미해결UIUX 포트폴리오 Part.3 - 반응형 웹 포트폴리오
폰트나 이미지사용 문의
안녕하세요 강의 듣고있는 학생입니다. 혹시 다운로드 파일에 있는 아이콘이나 폰트들취업용 개인 포트폴리오 웹사이트 만들때 사용해도 될까요?
-
미해결[2025년 출제기준] 웹디자인기능사 실기시험 완벽 가이드
레이어 팝업 '닫기' 가 안됩니다
<!DOCTYPE html> <html lang="ko"> <head> <meta charset="UTF-8"> <title>A1~A4레이아웃 연습</title> <link rel="stylesheet" href="style.css"> </head> <body> <div class="container"> <header> <div class="logo"></div> <div class="manu"></div> </header> <div class="silde"> <div></div> </div> <div class="items"> <div class="news"> <div class="tab-inner"> <div class="btn"> <a href="#none" class="active">공지사항</a> <a href="#none">갤러리</a> </div> <div class="tabs"> <div class="tab1"> <a class="open">SNS 발송 서비스 개선작업<b>2020.01.09</b></a> <a href="#none">휴대폰 인증 서비스 개선 작업<b b>2020.01.07</b></a> <a href="#none">카드사 부분 무이자 할부 이벤트<b>2019.12.31</b></a> <a href="#none">올엣 시스템 작업 안내<b>2019.12.20</b></a> <a href="#none">휴대폰 결제 시스템 작업 안내<b>2019.12.20</b></a> </div> <div class="tab2"> <a href="#none"><img src="image/1.jpg" alt="garllery1"></a> <a href="#none"><img src="image/2.jpg" alt="garllery2"></a> <a href="#none"><img src="image/3.jpg" alt="garllery3"></a> </div> </div> </div> </div> <div class="banner"></div> <div class="nav"></div> </div> <footer> <div class="copy"> <div class="copy2"></div> <div class="copy3"></div> </div> <div class="logo2"></div> </footer> <div class="model"> <div class="model-content"> <h1>SNS비회원주문하기 종료 안내</h1> <p>안녕하세요. JUST 쇼핑몰 MD 홍길동입니다. 안타깝게도 SNS비회원 주문하기 서비스가 한달 뒤 종료될 예정입니다. 회원가입 없이 SNS계정을 이용해 그동안 제품주문을 하실수 있었는데, 금번 강화된 개인정보보호법 시행령 제 9조 (부칙 3조)에 의거, SNS를 이용한 상품 주문/결제등이 근래에 많은 보안잇슈로 문제가 되고 있음에 따라 KISAS의 권고조치의 일환으로 했습니다. 따라서, 한달뒤인 2019.03.10 이후 모든 비회원 고객님들께서는 회원가입으로 전환 후 실명인증이 되어야 하며, 이는 모든 쇼핑몰/오픈마켓등의 전자상거레서비스의 공통된 사함이라는 점을 안내드립니다. </p> <a class="close-model">X 닫기</a> </div> </div> </div> <script src="js/jquery-1.12.4.js"></script> <script src="js/costom.js"></script> </body> </html> .container{ border: 1px solid #111; width: 1200px; margin: auto; } header{ width: 1200px; height: 100px; background-color: #222; } header div{ height: 100px; } .logo{ width: 170px; background-color: #333; float: left; } .manu{ width: 700px; background-color: #444; float: right; } .silde{ height: 300px; background-color: #555; } .items{ /* height: 200px; */ overflow: hidden; } .items>div{ display: inline-block; height: 200px; float: left; } .news{ width: 400px; background-color: #666; } .tab-inner{ margin: 5px 10px; } .btn{ } .btn .active{ background-color: #fff; } .btn a{ width: 100px; height: 50px; background-color: #888; border: 1px solid #000; display: inline-block; text-align: center; color: #111; text-decoration: none; box-sizing: border-box; padding: 13px 0; border-radius: 5px 5px 0 0; margin-left: -5px; border-bottom: none; cursor: pointer; } .tabs{ background-color: #fff; height: 145px; border: 1px solid #000; margin-left: -5px; margin-top: -1px; } .tab1 a.open{ cursor: pointer; } .tab1 a{ color: #000; text-decoration: none; box-sizing: border-box; border-bottom: 1px solid #000; display: block; margin: 3px; } .tab1 a:last-child{ border-bottom: none; } .tab1 a b{ float: right; font-weight: normal; } .tab2{ display: none; } .tab2 a{ box-sizing: border-box; display: inline-block; padding: 17px 0; margin-left: 10px } .tab2 img{ width: 110px; } .banner{ width: 400px; background-color: #777; } .nav{ width: 400px; height: 200px; background-color: #888; } footer{ height: 100px; background-color: #999; } footer> div{ float: left; height: 100px; } .copy{ width: 1030px; } .copy> div{ width: 1030px; height: 50px; } .copy2{ background-color: #444; } .copy3{ background-color: #777; } .logo2{ width: 170px; background-color: #222; } .model{ position: absolute; left: 0; top: 0; background-color: #00000028; width: 1200px; height: 700px; margin: 7px; display:block; display: none; } .model-content{ position: absolute; left: 50%; top: 50%; background-color: #fff; width: 500px; height: 400px; border: 1px solid #000; transform: translate(-50%,-50%); box-sizing: border-box; } .model-content h1{ color: #fff; background-color: #000; width: 450px; display: inline-block; text-align: center; margin: 25px; } .model-content p{ line-height: 26px; text-shadow: 0 0 3px #0000003d; text-align: center; } .close-model{ background-color: #000; width: 90px; height: 40px; display: inline-block; float: right; color: #fff; text-align: center; box-sizing: border-box; margin: 12px; padding: 6px; cursor: pointer; }$('.btn a:first-child').click(function(){ $('.tab1').show() $('.tab2').hide() $(this).addClass('active') $(this).siblings().removeClass('active') }) $('.btn a:last-child').click(function(){ $('.tab2').show() $('.tab1').hide() $(this).addClass('active') $(this).siblings().removeClass('active') }) $('.open').click (function(){ $('.model').fadeIn() }) $('.close-model').click (function(){ $('.mode1').fadeOut() })코드를 보내드립니다
-
미해결[말 한마디로 뚝딱!] AI와 함께 나만의 수익화 웹사이트를 만드는 법
애플리케이션 새 항목 추가
실행/디버그 구성하는 부분에서 갑자기 메인 클래스 부분이 jh로 변경되어 있고 파일 구조를 보면 jhApplication도 이미 생성되어 있는데 어떻게 하신건가요?끊김제거 및 추가 설명 강의에서도 이 부분이 없습니다
-
해결됨React, Node.js, MongoDB로 만드는 나만의 회사 웹사이트: 완벽 가이드
MODULE_NOT_FOUND 오류
code: 'MODULE_NOT_FOUND', requireStack: [ 'C:\\Users\\CompanyWebsite\\backend\\index.js' ] } Node.js v22.17.0 [nodemon] app crashed - waiting for file changes before starting... app.use("/api/auth", userRoute); 라우트 구성 후 thunder client로 apt 테스트 시 발생하는 오류입니다.
-
해결됨비전공자를 위한 진짜 입문 올인원 개발 부트캠프
그랩님, 해결되지 않은 에러 메시지 [꼭] 답변 부탁 드립니다.
그랩 선생님, 좋은 강의 만들어 주셔서 잘 듣고 있습니다.그런데 아무리 해도 에러가 나는 것을 해결하지 못하고 있어 2주 이상 진도를 나가지 못하고 있어 부득이하게질문을 여러번 올리게 됩니다. 현재 [그랩마켓] React로 웹 개발하기 -2 듣고 있는데요,1.그랩 선생님 소스 코드와 동일하게 아래 작성한 index.js 소스 첨부하는데요,실행하면,1초 동안 잠깐 판매되는 상품들 이미지 없이 전체 페이지 뜨다 바로 아래 첨부한 그림과 같이에러가 발생 합니다.이 에러는 어떻게 해결 할 수 있을까요?--------2. index.js 소스 아래에 작성 첨부 합니다. import './index.css'; import axios from "axios"; import React from 'react'; function MainPage(){ const [products, setProducts]=React.useState([]); React.useEffect( function(){ axios.get("이곳에는 제 mock 목 서버 주소를 넣었습니다/products") .then(function(result){ const products=result.data.products; setProducts(products); }).catch(function(error){ console.error("에러 발생:",error); }); },[]); return ( <div> <div id="header"> <div id="header-area"> <img src="../images/icons/logo.png" /> </div> </div> <div id="body"> <div id="banner"> <img src="../images/banners/banner1.png" /> </div> <h1>판매되는 상품들</h1> <div id="product-list"> { products.map(function(product, index){ return ( <div className="product-card"> <div> <img className="product-img" src={product.imageUrl} /> </div> <div className="product-contents"> <span className="product-name">{product.name} </span> <span className="product-price">{product.price}원 </span> <span className="product-seller"> <img className="product-avatar" src="../images/icons/avatar.png" /> <span>{product.seller}</span> </span> </div> </div> ); }) } </div> </div> <div id="footer"></div> </div> ); } export default MainPage;그리고, 추가적으로 아래 그랩님 답변 본 뒤 다시 시도해 본 후 질문이 있어 추가적으로 글을 적습니다.현재 postman을 실행하고요, 제 해당 목 mock 서버 주소를 입력 후 끝에 /products까지하면요, 아래와 첨부한 사진과 같이 잘 데이터를 받아오는 것 같은데요, 위에 에러 화면이 그대로 표시되어 어떻게 해결해야 하는지 방법을 모르겠습니다. 조금 구체적으로 어떻게 해결해야 하는지 단계별로 친절한 설명 부탁드립니다 위에는 mock 서버인 postman(포스트맨) 화면이고요,아래는 크롬 브라우저 에러 메시지를 첨부합니다. 참고> app.js 소스 첨부합니다.import logo from './logo.svg'; import './App.css'; import MainPage from "./main/index.js" function App() { return ( <div> <MainPage /> </div> ); } export default App; 또한 만약 그랩님께서 제 소스를 보시고 수정하여 에러가 해결된 완성된 index.js 소스가 있다면요,최종 완성된 수십 줄의 소스 코드를 아래 답변 댓글에 길더라도 다 첨부해주시면 완성된 소스 코드를 그대로 복사하여 vs code에 붙여 넣기 하고 싶은데요, 아래 답변 글에 남겨주시면 감사하겠습니다.-------------------------------------------------------------------------------------------------그리고, 아래 글에 나와 있는 답변데로,TypeError: Cannot read properties of undefined (reading ‘map’) 해결 방법서버 데이터 문제로 인한 map 함수 에러 고치기React 데이터 바인딩과 undefined 에러 처리위 해결책의 코멘트와 답변 대로 수정해 보아도 에러가 해결 되지 않았습니다.어떻게 해결 해야 하는지요? 빠른 답변 부탁 드립니다.
-
미해결[2025년 출제기준] 웹디자인기능사 실기시험 완벽 가이드
공지사항과 갤러리 탭(안)구성 중 마우스 클릭시 색상변경이 안됩니다.
마우스 클릭 갤러리마우스 클릭 공지사항 .js .html.css 세번 정도 다시 해보고 class명까지 바꿔가며 확인을 했지만 도저히 찾을 수가 없어요 이상하게 .js가 아예 안되는 것도 아니고 배경색만 바뀌지 않습니다 제가 보기엔 .btn a.active 가 .js로 입력이 안되는 것 같은데 정말 궁금하네요!
-
해결됨React, Node.js, MongoDB로 만드는 나만의 회사 웹사이트: 완벽 가이드
이미지 파일의 경로 설정에 대한 질문입니다.
src 폴더 안에 pages폴더와 assets폴더가 있는데 왜 경로를 ../../assets 이렇게 잡아야 하는 거죠? .. 을 두 번 쓰면 두 번 위로 올라가는 거니까 src 폴더 밖에서 assets 폴더를 찾겠다는 거 아닌가요?