0.0.0.0:8000 접속이 안됩니다
해결됨
실리콘밸리 엔지니어가 가르치는 파이썬 장고 웹프로그래밍
도커컴포즈 명령으로 실행시 localhost:8000은 접속이 되는데 .. 0.0.0.0:8000 도커서버로는 연결이 안됩니다 왜 그런가요?
- python
- django
- bootstrap
- rest-api
- drf
176만명의 커뮤니티!! 함께 토론해봐요.
해결됨
실리콘밸리 엔지니어가 가르치는 파이썬 장고 웹프로그래밍
도커컴포즈 명령으로 실행시 localhost:8000은 접속이 되는데 .. 0.0.0.0:8000 도커서버로는 연결이 안됩니다 왜 그런가요?
미해결
스프링 기반 REST API 개발
안녕하세요. 07.30 시간에 강사님께서 자바빈 스펙을 준수하게끔 테스트를 진행하십니다. 이 과정이 왜 필요한건지 궁금합니다~ builder패턴으로 테스트로만 잘 진행하면 충분하다는 생각이 들었기 때문입니다. 생성자로 객체를 만들어야 상태안전하게 만들 수 있고 setter를 사용하게 되는 것은 되도록 지양하는 것이라 생각했습니다.
미해결
[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - NestJS Core
[Nest] 39177 - 2025. 01. 23. 오후 2:27:12 LOG [RoutesResolver] CommonController {/common}: +1ms [Nest] 39177 - 2025. 01. 23. 오후 2:27:12 LOG [RouterExplorer] Mapped {/common/image, POST} route +0ms [Nest] 39177 - 2025. 01. 23. 오후 2:27:12 LOG [RoutesResolver] ChatsController {/chats}: +0ms /Users/hjlee/Documents/projects/node_study/nestjs_server/node_modules/path-to-regexp/src/index.ts:153 throw new TypeError(`Missing parameter name at ${i}: ${DEBUG_URL}`); ^ TypeError: Missing parameter name at 9: https://git.new/pathToRegexpError at name (/Users/hjlee/Documents/projects/node_study/nestjs_server/node_modules/path-to-regexp/src/index.ts:153:13) at lexer (/Users/hjlee/Documents/projects/node_study/nestjs_server/node_modules/path-to-regexp/src/index.ts:171:21) at lexer.next (<anonymous>) at Iter.peek (/Users/hjlee/Documents/projects/node_study/nestjs_server/node_modules/path-to-regexp/src/index.ts:188:32) at Iter.tryConsume (/Users/hjlee/Documents/projects/node_study/nestjs_server/node_modules/path-to-regexp/src/index.ts:195:24) at Iter.text (/Users/hjlee/Documents/projects/node_study/nestjs_server/node_modules/path-to-regexp/src/index.ts:213:26) at consume (/Users/hjlee/Documents/projects/node_study/nestjs_server/node_modules/path-to-regexp/src/index.ts:285:23) at parse (/Users/hjlee/Documents/projects/node_study/nestjs_server/node_modules/path-to-regexp/src/index.ts:320:18) at /Users/hjlee/Documents/projects/node_study/nestjs_server/node_modules/path-to-regexp/src/index.ts:503:40 at Array.map (<anonymous>) yarn add하여 위 에러가 발생해서 찾아보니 express 5.0.0일때 나타나는 에러라고 하네요. 25년 1월기준 yarn add 커맨드 입력당시 nestjs 10.x.x -> 11.x.x로 되면서 발생한 에러라서 다운그레이드하니 해결되긴 했습니다. 다른 수강생들에게 도움이될까 하여 남깁니다.
미해결
[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - NestJS Core
"devDependencies": { "@nestjs/cli": "^10.4.9", "@nestjs/schematics": "^10.2.3", "@types/express": "^4.17.17", "@types/jest": "^29.5.2", "@types/node": "^20.3.1", "@types/pg": "^8", "@types/supertest": "^6.0.0", "@yarnpkg/pnpify": "^4.1.3", "dotenv": "^16.4.7", "dotenv-cli": "^8.0.0", "jest": "^29.5.0", "source-map-support": "^0.5.21", "supertest": "^7.0.0", "ts-jest": "^29.1.0", "ts-loader": "^9.4.3", "ts-node": "^10.9.1", "tsconfig-paths": "^4.2.0", "typescript": "~5.3", "webpack": "^5.97.1" }, dotenv랑 dotenv-cli 설치하고 "start:dev": "dotenv -e .env nest start --watch", "start:debug": "dotenv -e .env -- yarn dlx @nestjs/cli start --debug --watch", 하면 정상적으로 동작합니다!
해결됨
[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - NestJS Core
코드팩토리 디스코드에 질문하면 더욱 빠르게 질문을 받아 볼 수 있습니다! [코드팩토리 디스코드] https://bit.ly/3HzRzUM 위 코드는 만료됬다고 나옵니다.
해결됨
[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - NestJS Core
아래 처럼 Post 또는 Tag 테이블에 값이 들어가면서 post_model_tags_tag_model 테이블에 값이 반영이 되는데요 실무에서는 실질적으로 Post 또는 Tag 테이블이 기존에 가지고 있던 값을 활용해서 post_model_tags_tag_model 테이블이 업데이트 되는 경우가 많은데요 즉, Post_1 이라는 Post 테이블의 값에 Tag_1만 적용되어 있었는데 추후에 Tag_2를 하려면 어떻게 해야하나요? 무조건 Post 테이블에 값을 삽입하면서 post_model_tags_tag_model 테이블에 값을 넣어줘야 하나요? @Post('posts/tags') async createPostTags() { //post_model 테이블에 삽입 const post1 = await this.postRepository.save({ title: 'NestJs Lecture', }); // post_model 테이블에 삽입 const post2 = await this.postRepository.save({ title: 'Programming Lecture', }); // post_model_tags_tag_model 테이블에 삽입 const tag1 = await this.tagRepository.save({ name: 'javascript', posts: [post1, post2], }); // post_model_tags_tag_model 테이블에 삽입 const tag2 = await this.tagRepository.save({ name: 'typescript', posts: [post1], }); // post_model_tags_tag_model 테이블에 삽입 const post3 = await this.postRepository.save({ title: 'NestJs Lecture', tags: [tag1, tag2], }); return true; }
해결됨
한 번에 끝내는 자바스크립트: 바닐라 자바스크립트로 SPA 개발까지
const workA = () => { return new Promise((resolve) => { setTimeout(() => { resolve(`workA`); }, 5000); }); }; const workB = () => { return new Promise((resolve) => { setTimeout(() => { resolve(`workB`); }, 3000); }); }; const workC = () => { return new Promise((resolve) => { setTimeout(() => { resolve(`workC`); }, 10000); }); }; const start = async () => { try { let results = await Promise.all([workA(), workB(), workC()]); console.log(results); results.forEach((res) => console.log(res)); } catch (err) { console.log(err); } }; [10:01] 강의 내용 보면 workA가 5초 workB가 3초, workC가 10초인데, 결국 출력 되는 값을 보면 동시에 출력이 됩니다. 그리고 순서도 A, B, C 순입니다. let resultA = await workA(); let resultB = await workB(); let resultC = await workC(); console.log(resultA); console.log(resultB); console.log(resultC); 물론 실행시간의 차이는 있지만, 실직적으로 프로그램에 표기 되는 값은 바로 위에 있는 코드예제에서 보여주신 A, B, C랑 같은데, 병령처리라면 시간이 짧은 B가 실행되고 그 다음에 A, 그 다음 C가 아웃풋으로 나와야 하는거 아닌가요??
미해결
[C#과 유니티로 만드는 MMORPG 게임 개발 시리즈] Part6: 웹 서버
MVC를 제대로 이해를 못했는데 넘어가도 될까요?
미해결
[C#과 유니티로 만드는 MMORPG 게임 개발 시리즈] Part6: 웹 서버
현재 ASP.NET과 많이 달라서 문의 드립니다. 어떻게 해야될까요?
미해결
[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - NestJS Core
AuthModule과 UserModule을 PostModule에 추가하면 Dependency 에러가 해결되는 것은 이해가 됐습니다. 다른 질문이 생겼는데요. 그러면 해당 Guard를 사용하는 모든 Module에 해당 Guard가 DI 받아서 사용하는 (여기서는 AuthService와 UserService) 모듈 (AuthModule, UserModule)을 import 해주어야 하는 건가요? 만약 AccessTokenGuard 를 모든 controller에서 사용한다면, 모든 모듈에 AuthModule, UserModule을 import 해주어야 하는 걸까요? 그리고 만약 Guard에 DI 가 새로 추가된다면, (예를 들면 NewModule의 NewService를 Guard가 필요로 한다면) 다시 원래 Guard가 사용되고 있던 모듈들 전부에 NewModule을 import 해줘야하는 걸까요? 제가 이해한게 맞다면, 의존성 측면에서 매우 좋지 않은 것 같아, 의문이 생겨 문의드립니다.
미해결
비전공자를 위한 풀스택 맛집지도 만들기 프로젝트!: Front, Back-end 그리고 배포까지
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>맛집지도</title> <meta name="author" content="동네코딩" /> <meta name="description" content="맛집지도 서비스" /> <meta name="keywords" content="동네코딩, 맛집지도, 유튜버맛집, 맛집유튜버" /> <link rel="stylesheet" href="style.css" /> </head> <body> <nav> <div class="inner"> <div class="nav-container"> <h1 class="nav-title">맛집지도</h1> <button class="nav-contact">Contact</button> </div> </div> </nav> <main> <section id="category"> <div class="inner"> <div class="category-container"> <h2 class="category-title">맛집지도 카테고리를 선택해보세요</h2> <div class="category-list"> <button class="category-item">한식</button ><button class="category-item">중식</button ><button class="category-item">일식</button ><button class="category-item">양식</button ><button class="category-item">분식</button ><button class="category-item">구이</button ><button class="category-item">회/초밥</button ><button class="category-item">기타</button> </div> </div> </div> </section> <!-- 카테고리 --> <div id="map" class="inner"></div> <!-- 카카오지도 --> </main> <script type="text/javascript" src="//dapi.kakao.com/v2/maps/sdk.js?appkey=da893e5911fb51d60018677ccb00c7be" ></script> <script src="script.js"></script> </body> </html> var container = document.getElementById('map'); //지도를 담을 영역의 DOM 레퍼런스 var options = { //지도를 생성할 때 필요한 기본 옵션 center: new kakao.maps.LatLng(33.450701, 126.570667), //지도의 중심좌표. level: 3 //지도의 레벨(확대, 축소 정도) }; var map = new kakao.maps.Map(container, options); //지도 생성 및 객체 리턴 @font-face { font-family: "KyoboHandwriting2020A"; src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2112@1.0/KyoboHandwriting2020A.woff") format("woff"); font-weight: normal; font-style: normal; } * { padding: 0; margin: 0; box-sizing: border-box; } html { font-size: 10px; font-family: "KyoboHandwriting2020A"; } nav { /* background-color: #e69a06; */ } .nav-container { padding: 1rem 0; display: flex; flex-direction: row; justify-content: space-between; align-items: center; } .nav-title { font-size: 3rem; } .nav-contact { font-size: 2.5rem; border: 0; background: none; cursor: pointer; font-family: inherit; } .category-title { font-size: 3.5rem; } .category-item { width: 25%; height: 5rem; background: none; border: none; font-family: inherit; font-size: 1.6rem; } .category-item:hover { color: #e69a06; cursor: pointer; } .inner { padding: 0 1.5rem; } @media all and (min-width: 1024px) { .inner { max-width: 1024px; margin: 0 auto; } } /* 카카오맵 CSS */ body { height: 100vh; } nav { height: 59px; } main { padding-top: 1.5rem; height: calc(100% - 59px); display: flex; flex-direction: column; } #map { flex-grow: 1; width: 100%; height: 100%; } 이렇게 작성하였습니다. 자꾸 에러가 나서 자료 그대로 복붙한 후 appkey만 수정해주었습니다! 자꾸 위와 같은 에러가 뜹니다. 사이트 도메인도 위와 같이 설정하였고 앱키도 위와 같이 설정하였는데 자꾸 에러가 뜨는 이유는 뭔가요..
미해결
[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - NestJS Core
모듈마다 provider를 설정해줘야 되는 장점이 몰까요? 예를 들어 post.service 를 post.controller 에도 쓸수있지만 user.service 에도 post.service를 주입해도 쓸수있는데 그럼 user.module에 또 provider로 post.service를 추가 해야되는건가요? 그냥 IoC에서 등록만하면 되게 하지않았을까요?
해결됨
[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스
https://github.com/expressjs/cors?tab=readme-ov-file#enable-cors-for-a-single-route 참고하여 작성 해 보았습니다. * 제일 하단부에는 전체 코드 첨부 하였습니다. * 문제는 2가지 입니다. 1. 단일 경로에 CORS 활성화를 구현하고 싶었으며 corsOptions 에 methods 를 'POST, OPTIONS'만 추가하였음에도 get은 호출시 허용이 되었습니다. app.get('/users/', cors(corsOptions), function (req, res) { 제가 구현하고 싶었던 코드의 의도는 특정 IP만 사용 허용 이기 때문에 위와 같이 구현하고 싶었습니다. 하지만 아래와 같이 호출하여도 허용이 되었습니다. app.get('/users/', (req, res) => { 나머지 문제는 위와 반대로 POST의 경우에는 app.post('/token/phone', cors(corsOptions), (req, res) => { 위처럼 작성 옵션도 적용되었음에도 불구하고 CORS 가 계속 발생합니다. 아래는 작성한 node 코드입니다. import express from 'express' import { createTokenOfPhone } from '../../../section01/01-03-token-api-facade/index.js' import { swaggerUi, specs } from "./swagger/swagger.config.js"; import cors from 'cors' const app = express() app.use(express.json()) // Swagger API app.use("/api-docs", swaggerUi.serve, swaggerUi.setup(specs, { explorer: true })); // 허용할 IP WhiteList const whitelist = [ 'http://127.0.0.1:5500' ]; const corsOptions = { origin: (origin, callback) => { if (whitelist.indexOf(origin) !== -1 || !origin) { // !origin은 로컬 요청을 허용 callback(null, true); } else { callback(new Error('Not allowed by CORS')); } }, origin: whitelist, methods: 'POST, OPTIONS', }; //CORS 설정 // app.use(cors()) // app.use(cors(corsOptions)) // 특정 IP 허용 app.get('/users/', cors(corsOptions), function (req, res) { // app.get('/users/', (req, res) => { res.json({msg: 'getdms 왜 됨?'}) }) // OPTIONS 요청에 대한 응답 처리 app.options('/users/', cors(corsOptions), (req, res) => { res.setHeader('Access-Control-Allow-Origin', req.headers.origin || '*'); res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS'); res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization'); res.setHeader('Access-Control-Allow-Credentials', 'true'); res.sendStatus(204); // No Content }); // app.post('/token/phone', (req, res) => { app.post('/token/phone', cors(corsOptions), (req, res) => { const {phoneNo} = req.body; console.log(`phoneNo ${phoneNo}`) const requestToken = createTokenOfPhone(phoneNo); const resultData = { data: requestToken }; res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization'); res.send(resultData); }); app.listen(3000); // 포트번호 아래는 get , options, post 를 호출하는데 사용한 코드입니다. 주석 되어있는 get 호출시에는 호출안되게 옵션 설정해도 호출되고 주석 안한 post 호출시에는 정상 호출되어야 할 것 같은데 안됩니다.... <script> let resultToken = ''; const certification = () => { let myPhoneNo = document.getElementById("phoneNo").value; // let api = axios.options("http://localhost:3000/users"); // let api = axios.get("http://localhost:3000/users"); let api = axios.post("http://localhost:3000/token/phone", {phoneNo: myPhoneNo}); }; </script> <body> <div>휴대폰번호: <input type="text" id="phoneNo"> <button onclick="certification()">인증하기</button> <br/> <div>인증상태</div> <button>회원가입하기</button> </div> </body>
미해결
비전공자를 위한 풀스택 맛집지도 만들기 프로젝트!: Front, Back-end 그리고 배포까지
.category-item에서 width를 24%로 해야 4등분이 되고 25%로 하면 3등분이 됩니다. 이건 제가 질문하려는 내용과 뭔가 관련이 있는 것 같아서 말씀드리는거고 css #map에서 height를 픽셀로 안하면 지도가 나오지도 않고 픽셀로 해도 지도가 일부분만 나옵니다. 지도자체를 인용하는거는 문제가 없어보이는데 왜 안나올까요? @font-face { font-family: 'ChosunCentennial'; src: url('https://gcore.jsdelivr.net/gh/projectnoonnu/noonfonts_2206-02@1.0/ChosunCentennial.woff2') format('woff2'); font-weight: normal; font-style: normal; } *{ padding: 0; margin: 0; box-sizing: border-box; } html{ font-size: 10px; font-family: 'ChosunCentennial'; } nav{ background-color: white; } .nav-container{ padding: 1rem 0; display: flex; flex-direction: row; justify-content:space-between; align-items: center; } .nav-title{ font-size: 3rem; } .nav-contact{ font-size: 2.5rem; border: 0; background: none; cursor: pointer; font-family: inherit; } .category-title{ font-size: 3.5rem; } .category-item{ width: 24%; height: 5rem; background: none; border: none; font-family: inherit; font-size: 1.6rem; } .category-item:hover { color: orange; cursor: pointer; } .inner{ padding: 0 1.5rem; } @media all and (min-width: 1024px){ .inner{ max-width: 1024px; margin: 0 auto; } } /*카카오맵 css*/ body{ height: 100vh; } nav{ height: 59px; } main{ padding-top: 1.5rem; height: calc(100%-59px); display: flex; flex-direction: column; } #map{ flex-wrap: 1; width: 100%; height: 100px; }
미해결
ASP.NET Core MVC +ASP.NET Core +REST API +.NET 8.0
과정에서 보면 CreateUserDTO GetAllUserResponseDTO GetUserDTO GetUserRsponseDTO 이렇게 생성을 했는데 그냥 UserDTO 하나만 생성해서 사용하면 안되는 건가요?
미해결
[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - NestJS Core
안녕하세요 선생님. 질문이 있습니다! @CreateDateColumn({ name: 'mb_regs_tm', type: 'timestamp', comment: '등록일시', }) regs_tm: Date; @UpdateDateColumn({ name: 'mb_mod_tm', type: 'timestamp', nullable: true, comment: '수정일시', }) mod_tm: Date; 위 데코레이션으로 만든 컬럼은 따로 시간을 지정해주지 않다보니 자동으로 UTC로 값이 설정되는데요. 문제는 @Column({ name: 'mb_exp_tm', type: 'timestamp', nullable: true, comment: '만료일시', }) exp_tm: Date; 이 컬럼의 경우 export function getExpirationDate(days: number): Date { const now = new Date(); return new Date(now.setDate(now.getDate() + days)); } 위의 함수를 사용하여 데이터가 생성된 날로부터 90일을 더한 값으로 만료일을 설정하거든요. 근데 mb_exp_tm 컬럼만 KST로 설정되고 나머지 mb_regs_tm, mb_mod_tm는 UTC로 데이터가 저장됩니다. https://github.com/typeorm/typeorm/issues/5841 위 이슈에서도 제가 현재 고민하고 있는 부분에 대해 얘기하고 있지만 명확한 답은 아직 찾질 못해서요. 혹시 위 문제에 대한 해결책을 들을 수 있을까요?
미해결
[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - NestJS Core
@Get(':commentId') getComment(@Param('commentId', ParseIntPipe) commentId: number) { return this.commentsService.getCommentById(commentId); } 안녕하세요 코드팩토리님해당 강의 듣는중 CommentController의 getComment 메서드에서 분명 특정 post의 특정 comment를 가져와야할거같은데 보면 commentId로만 조회하는걸로 보여집니다.제가 이해하지 못하고 의도를 파악하지 못한건지 반대인지 확인이 필요해보입니다. 상기는 해당 문제되어 보여지는 코드입니다. 강의에서는 postman을 사용해 해당 엔드포인트로 요청하는 장면이있는데 postId에 152? 게시글ID 값을 넣어서 조회하는데 코드대로면 의미가 없어보입니다. 감사합니다.
해결됨
ASP.NET Core MVC +ASP.NET Core +REST API +.NET 8.0
11강 따라하다가 상단에 using System.Data .SqlClient; 설치도 잘 돼서 선언도 됐는데 using (SqlConnection sqlConnection = new SqlConnection(connectionString)) 이부분에 경고 CS0618 'SqlConnection'은(는) 사용되지 않습니다. 'Use the Microsoft.Data .SqlClient package instead.' 이런 경고가 나옵니다. 이것을 어떻게 수정해야 하나요?
미해결
[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - NestJS Core
http://localhost:3000/posts/:id 를 send하게되면 NotFoundException()이 실행이 되야하는데 이런 에러가 나옵니다 async getPostById(id: number) { const post = await this.postsRepository.findOne({ where: { id, }, }); if (!post) { throw new NotFoundException(); } return post; } 잘 입력한 것 같은데 . 왜그런가요?
해결됨
한 번에 끝내는 자바스크립트: 바닐라 자바스크립트로 SPA 개발까지
안녕하세요 ! 해당 강의를 듣고 기능은 비슷한데 내용은 조금 다른 홈페이지를 제작해보고 싶어져서 질문 드립니다 ! API를 호출하는 기능은 이해했는데, 강사님이 만드신 API 처럼 저도 직접 간단한 정보를 담은 api 를 만들어보고 싶은데 이 부분은 어떻게 제작하는 지 알 수 있을까요?!